4
我有我創建一個事件類,目前看起來如下:如何在屬性中存儲多個值類型?
public class SharePointOnErrorEventsArgs : EventArgs
{
public SharePointOnErrorEventsArgs(string message, bool showException, Exception exception)
{
Message = message;
Exception = exception;
ShowException = showException;
}
/// <summary>
/// Property to allow the storage of a more verbose and explainable error message
/// </summary>
public string Message { get; private set; }
/// <summary>
/// Object to store full exception information within
/// </summary>
public Exception Exception { get; private set; }
/// <summary>
/// Boolean value allows for verbose messages to be sent up the stack without
/// the need for displaying a full exception object, or stack trace.
/// </summary>
public bool ShowException { get; private set; }
}
現在,而不是發送對showException
true
或false
我想送三個值Debug
之一,Info
或Error
- 我該如何處理這樣的事情?我真的不想使用字符串,因爲我希望始終將其限制爲這三個值中的一個,但我不確定如何在使用屬性時處理此問題。
這是一個'enum'你要尋找的。 –