MissingFieldException.Message 속성

정의

손실된 필드의 시그니처, 클래스 이름 및 필드 이름을 나타내는 텍스트 문자열을 가져옵니다. 이 속성은 읽기 전용입니다.

public:
 virtual property System::String ^ Message { System::String ^ get(); };
public override string Message { get; }
member this.Message : string
Public Overrides ReadOnly Property Message As String

속성 값

String

오류 메시지 문자열입니다.

예제

다음 예제는 Message 속성입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 MissingFieldException 클래스입니다.

try
{
    // Attempt to access a static AField field defined in the App class.
    // However, because the App class does not define this field,
    // a MissingFieldException is thrown.
    App::typeid->InvokeMember("AField", BindingFlags::Static |
        BindingFlags::SetField, nullptr, nullptr, gcnew array<Object^>{5});
}
catch (MissingFieldException^ ex)
{
    // Show the user that the AField field cannot be accessed.
    Console::WriteLine("Unable to access the AField field: {0}",
        ex->Message);
}
try
{
    // Attempt to access a static AField field defined in the App class.
    // However, because the App class does not define this field,
    // a MissingFieldException is thrown.
    typeof(App).InvokeMember("AField", BindingFlags.Static | BindingFlags.SetField,
        null, null, new Object[] { 5 });
}
catch (MissingFieldException e)
{
 // Show the user that the AField field cannot be accessed.
 Console.WriteLine("Unable to access the AField field: {0}", e.Message);
}
try
    // Attempt to access a static AField field defined in the App class.
    // However, because the App class does not define this field,
    // a MissingFieldException is thrown.
    typeof<App>.InvokeMember("AField", BindingFlags.Static ||| BindingFlags.SetField, null, null, [| box 5 |])
    |> ignore
with :? MissingFieldException as e ->
    // Show the user that the AField field cannot be accessed.
    printfn $"Unable to access the AField field: {e.Message}"
Try
    ' Attempt to access a static AField field defined in the App class.
    ' However, because the App class does not define this field, 
    ' a MissingFieldException is thrown.
    GetType(App).InvokeMember("AField", BindingFlags.Static Or BindingFlags.SetField, _
                               Nothing, Nothing, New [Object]() {5})
Catch e As MissingFieldException
    ' Show the user that the AField field cannot be accessed.
    Console.WriteLine("Unable to access the AField field: {0}", e.Message)
End Try

설명

개체가 생성될 때 클래스 이름을 지정하지 않으면 기본 클래스에서 상속된 기본 텍스트 문자열이 반환됩니다. 이 속성은 재정의합니다.Message 오류 메시지는 지역화되어야 합니다.

적용 대상