共用方式為


ValidationMessage Class

Represents a validation message that states an error, a warning, or a message.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Modeling.Validation.ValidationMessage
    Microsoft.VisualStudio.Modeling.Shell.TaskValidationMessage

Namespace:  Microsoft.VisualStudio.Modeling.Validation
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'宣告
Public Class ValidationMessage
public class ValidationMessage
public ref class ValidationMessage
type ValidationMessage =  class end
public class ValidationMessage

The ValidationMessage type exposes the following members.

Constructors

  Name Description
Protected method ValidationMessage(ValidationContext, String) Initializes a new instance of the ValidationMessage class using a context and a description for the message.
Protected method ValidationMessage(ValidationContext, String, Int32, Int32) Initializes a new instance of the ValidationMessage class using a context, a description, a line number, and a column number for the message.
Protected method ValidationMessage(ValidationContext, String, String, ViolationType) Initializes a new instance of the ValidationMessage class using a context, a description, a code, and a violation type for the message.

Top

Properties

  Name Description
Public property Code Gets the code for the message.
Public property Column Gets the column in a line of text where the error occurs.
Public property Context Gets the context information for a validation message.
Public property Description Gets the description for a validation message.
Public property File Gets the name of a referenced file.
Public property HelpKeyword Gets or sets the keyword to search for in the Help for Visual Studio.
Public property Line Gets the line number in the file to which the error or the warning refers.
Public property ReferencedFiles Gets the names of files to which the ValidationMessage refers.
Public property ReferencedModelElements Gets the model elements that are referenced by this message.
Public property Type Gets the type of validation message.

Top

Methods

  Name Description
Public method Equals Checks to see whether the validation message is equal to another object. (Overrides Object.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Gets an identifier for a ValidationMessage. (Overrides Object.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Identifies the validation message. (Overrides Object.ToString().)
Public method UpdateFileReferences(IEnumerable<String>) Contains the names of files to update from a list of zero or more file names.
Public method UpdateFileReferences(String) Contains the name of the file to update.
Public method UpdateReferencedModelElements Updates the referenced model elements.

Top

Remarks

A ValidationMessage is created in a user-defined validation method. The actual creation is completed through the virtual ValidationContext.ConstructValidationMessage method.

This class represents validation messages that the ValidationMessageObserver class can obtain.

For more information, see Validation in a Domain-Specific Language.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Modeling.Validation Namespace