(For completeness, I'm using switches with my TraceSource object, rather than the old static Trace class, though I doubt it makes much difference.)推荐答案区别在于 TraceSwitch 可与 Trace 消息一起使用,而 SourceSwitch 则可使用与 TraceSource 消息一起使用,这些消息将消息与其来源相关联.因此,使用 SourceSwitch ,您可以根据跟踪消息的来源来配置侦听器.The difference is that TraceSwitch works with Trace messages whereas SourceSwitch works with TraceSource messages, which associate the messages with their source. So with a SourceSwitch you can configure your listeners based on on where the trace messages came from.我同意文档并没有直接指出差异,而是在相关的 TraceSource 类文档,您将找到以下内容:I agree the documentation doesn't directly point out the difference, but dig around in the related TraceSource class documentation and you'll find this:还有一个示例向您展示如何配置 SourceSwitch 以关闭来自跟踪源的跟踪.There is also a sample showing you how to configure a SourceSwitch to turn off tracing from a trace source. 这篇关于TraceSwitch和SourceSwitch-有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-07 02:23