MarkOperationResult 列舉型別
CommentMarkAtProfile、CommentMarkProfile 和 MarkProfile 會使用 MarkOperationResult 列舉傳回成功或失敗。
命名空間: Microsoft.VisualStudio.Profiler
組件: Microsoft.VisualStudio.Profiler (在 Microsoft.VisualStudio.Profiler.dll 中)
語法
'宣告
Public Enumeration MarkOperationResult
public enum MarkOperationResult
public enum class MarkOperationResult
type MarkOperationResult
public enum MarkOperationResult
成員
成員名稱 | 說明 | |
---|---|---|
ErrorOutOfMemory | 無法使用記憶體記錄事件。標記和註解都不會記錄。 | |
ErrorNoSupport | 此內容不支援任何標記。標記和註解都不會記錄。 | |
ErrorTextTooLong | 字串超過最大值 256 字元,註解字串遭截斷,且已記錄標記和註解。 | |
ErrorMarkerReserved | 該參數小於或等於 0。會保留這些值。標記和註解都不會記錄。 | |
ErrorModeOff | 呼叫函式時,全域分析層級是設定為 OFF。標記和註解都不會記錄。 | |
ErrorModeNever | 當呼叫函式時,分析模式是設定為 NEVER。標記和註解都不會記錄。 | |
OK | 呼叫成功。 |
範例
這些範例將說明 MarkOperationResult 列舉。
第一個範例將說明 ErrorModeReserved 值。
public void ExerciseMarkOperationResult()
{
// Declare enumeration to hold return value of
// call to MarkProfile.
MarkOperationResult result;
// Force MarkProfile to return a value that says an error
// occurred. In this case, MarkProfile should be passed
// a value greater than or equal to zero. Passing in
// a -1 should return a value that indicates that the
// passed in parameter was less than or equal to zero.
result = DataCollection.MarkProfile(-1);
if (result == MarkOperationResult.ErrorMarkerReserved)
{
Console.WriteLine("Valid Result: Input was -1 and MarkProfile returned {0}", result);
}
else
{
Console.WriteLine("Invalid Result: MarkProfile Returned code {0} with input {1}", result.ToString(), -1);
}
}
第二則範例將說明可保存 CommentMarkProfile 方法呼叫之傳回值的 MarkOperationResult 列舉。
public void ExerciseMarkOperationResult()
{
// Declare and initialize variables to pass to
// CommentMarkProfile. The values of these
// parameters are assigned based on the needs
// of the code; and for the sake of simplicity
// in this example, the variables are assigned
// arbitrary values.
int markId = 02;
string markText = "Exercising CommentMarkProfile...";
// Declare enumeration to hold return value of
// call to CommentMarkProfile.
MarkOperationResult markResult;
markResult = DataCollection.CommentMarkProfile(
markId,
markText);
Console.WriteLine("CommentMarkProfile returned {0}",
markResult);
}