次の方法で共有


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 列挙型の使用例を次に示します。

1 つ目の例は、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);
            }
        }

2 つ目は、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);
        }

参照

参照

Microsoft.VisualStudio.Profiler 名前空間