mscorlib(4.0.0.0) API with additions
EventInstance.cs
2 
3 namespace System.Diagnostics
4 {
6  public class EventInstance
7  {
8  private int _categoryNumber;
9 
10  private EventLogEntryType _entryType = EventLogEntryType.Information;
11 
12  private long _instanceId;
13 
17  public int CategoryId
18  {
19  get
20  {
21  return _categoryNumber;
22  }
23  set
24  {
25  if (value > 65535 || value < 0)
26  {
27  throw new ArgumentOutOfRangeException("value");
28  }
29  _categoryNumber = value;
30  }
31  }
32 
37  {
38  get
39  {
40  return _entryType;
41  }
42  set
43  {
44  if (!Enum.IsDefined(typeof(EventLogEntryType), value))
45  {
46  throw new InvalidEnumArgumentException("value", (int)value, typeof(EventLogEntryType));
47  }
48  _entryType = value;
49  }
50  }
51 
55  public long InstanceId
56  {
57  get
58  {
59  return _instanceId;
60  }
61  set
62  {
63  if (value > uint.MaxValue || value < 0)
64  {
65  throw new ArgumentOutOfRangeException("value");
66  }
67  _instanceId = value;
68  }
69  }
70 
75  public EventInstance(long instanceId, int categoryId)
76  {
77  CategoryId = categoryId;
78  InstanceId = instanceId;
79  }
80 
90  public EventInstance(long instanceId, int categoryId, EventLogEntryType entryType)
91  : this(instanceId, categoryId)
92  {
93  EntryType = entryType;
94  }
95  }
96 }
int CategoryId
Gets or sets the resource identifier that specifies the application-defined category of the event ent...
EventLogEntryType
Specifies the event type of an event log entry.
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
Represents language-neutral information for an event log entry.
Definition: EventInstance.cs:6
long InstanceId
Gets or sets the resource identifier that designates the message text of the event entry.
The exception thrown when using invalid arguments that are enumerators.
EventInstance(long instanceId, int categoryId)
Initializes a new instance of the T:System.Diagnostics.EventInstance class using the specified resour...
static bool IsDefined(Type enumType, object value)
Returns an indication whether a constant with a specified value exists in a specified enumeration.
Definition: Enum.cs:577
Provides the base class for enumerations.
Definition: Enum.cs:14
EventInstance(long instanceId, int categoryId, EventLogEntryType entryType)
Initializes a new instance of the T:System.Diagnostics.EventInstance class using the specified resour...
EventLogEntryType EntryType
Gets or sets the event type of the event log entry.