ExportCodeAnalysisRuleAttribute.Description 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
규칙에 대한 설명입니다. 이는 규칙이 경고하거나 차단하기 위한 내용에 대한 간단한 사람이 읽을 수 있는 설명이어야 합니다. 이 필드는 지역화할 수 있지만 이 작업은 설명 속성을 서브클래싱 ExportCodeAnalysisRuleAttribute 하고 재정의해야 합니다.
public virtual string Description { get; set; }
member this.Description : string with get, set
Public Overridable Property Description As String
속성 값
예제
// Example of an Attribute class that supports localized descriptions:
public class TestLocalizedExportCodeAnalysisRuleAttribute : ExportCodeAnalysisRuleAttribute
{
private readonly string _descriptionResourceName;
private string _descriptionValue;
public TestLocalizedExportCodeAnalysisRuleAttribute(string id, string displayName, string descriptionResourceName)
: base(id, displayName)
{
_descriptionResourceName = descriptionResourceName;
}
public override string Description
{
get
{
if (_descriptionValue == null)
{
// Using the descriptionResourceName as the key for looking up the description in the resources file.
// MyResources is a resource file in the same project as the LocalizedExportCodeAnalysisRuleAttribute class.
// For each rule, and entry should be added to the resources file with the descriptionResourceName as the
// key and the description as the value
_descriptionValue = MyResources.ResourceManager.GetString(_descriptionResourceName);
}
return _descriptionValue;
}
}
}