Switch.GetSupportedAttributes 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
스위치에서 지원하는 사용자 지정 특성을 가져옵니다.
protected:
virtual cli::array <System::String ^> ^ GetSupportedAttributes();
protected public:
virtual cli::array <System::String ^> ^ GetSupportedAttributes();
protected virtual string[]? GetSupportedAttributes();
protected virtual string[] GetSupportedAttributes();
protected internal virtual string[] GetSupportedAttributes();
abstract member GetSupportedAttributes : unit -> string[]
override this.GetSupportedAttributes : unit -> string[]
Protected Overridable Function GetSupportedAttributes () As String()
Protected Friend Overridable Function GetSupportedAttributes () As String()
반품
스위치에서 지원하는 사용자 지정 특성의 이름이 들어 있거나 null 지원되는 사용자 지정 특성이 없는 문자열 배열입니다.
예제
다음 코드 샘플에서는 사용자 지정 스위치에 GetSupportedAttributes 대한 메서드의 재정의를 보여 있습니다.
public class MySourceSwitch : SourceSwitch
{
int sourceAttribute = 0;
public MySourceSwitch(string n) : base(n) { }
public int CustomSourceSwitchAttribute
{
get
{
foreach (DictionaryEntry de in this.Attributes)
if (de.Key.ToString().ToLower() == "customsourceswitchattribute")
sourceAttribute = (int)de.Value;
return sourceAttribute;
}
set { sourceAttribute = (int)value; }
}
protected override string[] GetSupportedAttributes()
{
return new string[] { "customsourceSwitchattribute" };
}
}
Public Class MySourceSwitch
Inherits SourceSwitch
Private sourceAttribute As Integer = 0
Public Sub New(ByVal n As String)
MyBase.New(n)
End Sub
Public Property CustomSourceSwitchAttribute() As Integer
Get
Dim de As DictionaryEntry
For Each de In Me.Attributes
If de.Key.ToString().ToLower() = "customsourceswitchattribute" Then
sourceAttribute = Fix(de.Value)
End If
Next de
Return sourceAttribute
End Get
Set(ByVal value As Integer)
sourceAttribute = Fix(Value)
End Set
End Property
Protected Overrides Function GetSupportedAttributes() As String()
Return New String() {"customsourceSwitchattribute"}
End Function 'GetSupportedAttributes
End Class
설명
메서드의 기본 구현은 .를 GetSupportedAttributes 반환합니다 null. 스위치가 구성 파일에 추가되고 반환된 문자열 배열 GetSupportedAttributesConfigurationException 에 포함되지 않은 사용자 지정 특성이 지정되면 스위치가 로드될 때 throw됩니다.
상속자 참고
클래스 또는 파생 클래스에서 상속할 때 클래스에 Switch 대한 사용자 지정 특성을 제공하도록 메서드를 재정의 GetSupportedAttributes() 할 수 있습니다.