Wyliczenie MarkOperationResult
CommentMarkAtProfile, CommentMarkProfile i MarkProfile zwraca sukces lub Niepowodzenie przy użyciu wyliczenia MarkOperationResult.
Przestrzeń nazw: Microsoft.VisualStudio.Profiler
Zestaw: Microsoft.VisualStudio.Profiler (w Microsoft.VisualStudio.Profiler.dll)
Składnia
'Deklaracja
Public Enumeration MarkOperationResult
public enum MarkOperationResult
public enum class MarkOperationResult
type MarkOperationResult
public enum MarkOperationResult
Elementy członkowskie
Nazwa elementu członkowskiego | Opis | |
---|---|---|
ErrorMarkerReserved | Parametr jest mniejsza niż lub równa 0.Wartości te są zastrzeżone.Znak i komentarz nie są rejestrowane. | |
ErrorModeNever | Tryb profilowania została ustawiona nigdy, gdy funkcja została wywołana.Znak i komentarz nie są rejestrowane. | |
ErrorModeOff | Globalny poziom profilowania była ustawiona na OFF, gdy funkcja została wywołana.Znak i komentarz nie są rejestrowane. | |
ErrorNoSupport | Brak obsługi znaku, w tym kontekście.Znak i komentarz nie są rejestrowane. | |
ErrorOutOfMemory | Aby zarejestrować zdarzenie nie dostępnej pamięci.Znak i komentarz nie są rejestrowane. | |
ErrorTextTooLong | Ciąg znaków przekracza maksymalnie 256 znaków.Ciąg komentarza jest obcinany i rejestrowane są znaku i komentarz. | |
OK | Wywołanie zakończyło się pomyślnie. |
Przykłady
Poniższe przykłady ilustrują wyliczenia MarkOperationResult.
W pierwszym przykładzie zilustrowano wartość 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);
}
}
Drugi przykład ilustruje wyliczenia MarkOperationResult, aby pomieścić wartość zwracaną przez wywołanie metody CommentMarkProfile.
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);
}