Initial commit
[mono.git] / mcs / class / referencesource / System / compmod / system / diagnostics / SourceFilter.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="SourceFilter.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //------------------------------------------------------------------------------
6
7 using System;
8 using System.Collections;
9
10 namespace System.Diagnostics {
11     public class SourceFilter : TraceFilter {
12         private string src;
13         
14         public SourceFilter(string source) {
15             Source = source;
16         }
17
18         public override bool ShouldTrace(TraceEventCache cache, string source, TraceEventType eventType, int id, string formatOrMessage, 
19                                          object[] args, object data1, object[] data) {
20              if (source == null)
21                 throw new ArgumentNullException("source");
22              
23              return String.Equals(src, source);
24         }
25
26         public String Source {
27             get { 
28                 return src; 
29             }
30             set {
31                 if (value == null)
32                    throw new ArgumentNullException("source");
33                 src = value;
34             }
35         }
36     }
37 }
38