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);
            }
        }

第二个示例演示 MarkOperationResult 枚举,该枚举保存调用 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);
        }

请参见

参考

Microsoft.VisualStudio.Profiler 命名空间