MissingFieldExceptionとは? わかりやすく解説

MissingFieldException クラス

存在しないフィールドに動的にアクセスしようとした場合にスローされる例外。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class MissingFieldException
    Inherits MissingMemberException
    Implements ISerializable
Dim instance As MissingFieldException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public class MissingFieldException : MissingMemberException,
 ISerializable
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class MissingFieldException : public
 MissingMemberException, ISerializable
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class MissingFieldException extends
 MissingMemberException implements ISerializable
SerializableAttribute 
ComVisibleAttribute(true) 
public class MissingFieldException extends
 MissingMemberException implements ISerializable
解説解説
使用例使用例

この例では、リフレクションを使用して存在しないメソッドを呼び出そうとしたか、または存在しないフィールドにアクセスしようとした場合の動作を示します。アプリケーションは、MissingMethodException、MissingFieldException、および MissingMemberException をキャッチして回復します。

using System;
using System.Reflection;

public class App 
{
    public static void Main()
 
    { 
        
        try 
        {
            // Attempt to call a static DoSomething method defined in
 the App class.
            // However, because the App class does not define this field,
 
            // a MissingFieldException is thrown.
            typeof(App).InvokeMember("DoSomething", BindingFlags.Static
 | 
                BindingFlags.InvokeMethod, null, null,
 null);
        }
        catch (MissingMethodException e) 
        {
            // Show the user that the DoSomething method cannot be called.
            Console.WriteLine("Unable to call the DoSomething method: {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, 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 AnotherField field defined
 in the App class.
            // However, because the App class does not define this field,
 
            // a MissingFieldException is thrown.
            typeof(App).InvokeMember("AnotherField", BindingFlags.Static
 | 
                BindingFlags.GetField, null, null,
 null);
        }        
        catch (MissingMemberException e) 
        {
         // Notice that this code is catching MissingMemberException
 which is the  
         // base class of MissingMethodException and MissingFieldException.
         // Show the user that the AnotherField field cannot be accessed.
         Console.WriteLine("Unable to access the AnotherField field: {0}",
 e.Message);
        }
    }       
}
// This code produces the following output.
//
// Unable to call the DoSomething method: Method 'App.DoSomething' not
 found.
// Unable to access the AField field: Field 'App.AField' not found.
// Unable to access the AnotherField field: Field 'App.AnotherField'
 not found.
using namespace System;
using namespace System::Reflection;

ref class App 
{       
};

int main()
{
    try 
    {
        // Attempt to call a static DoSomething method defined in the
 App class.
        // However, because the App class does not define this field,
 
        // a MissingFieldException is thrown.
        App::typeid->InvokeMember("DoSomething", BindingFlags::Static
 | 
            BindingFlags::InvokeMethod, nullptr, nullptr, nullptr);
    }
    catch (MissingMethodException^ ex) 
    {
        // Show the user that the DoSomething method cannot be called.
        Console::WriteLine("Unable to call the DoSomething method: {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.
        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 AnotherField field defined in
 the App class.
        // However, because the App class does not define this field,
 
        // a MissingFieldException is thrown.
        App::typeid->InvokeMember("AnotherField", BindingFlags::Static
 | 
            BindingFlags::GetField, nullptr, nullptr, nullptr);
    }        
    catch (MissingMemberException^ ex) 
    {
        // Notice that this code is catching MissingMemberException
 which is the  
        // base class of MissingMethodException and MissingFieldException.
        // Show the user that the AnotherField field cannot be accessed.
        Console::WriteLine("Unable to access the AnotherField field: {0}",
 
            ex->Message);
    }
}
// This code produces the following output.
//
// Unable to call the DoSomething method: Method 'App.DoSomething' not
 found.
// Unable to access the AField field: Field 'App.AField' not found.
// Unable to access the AnotherField field: Field 'App.AnotherField'
 not found.
継承階層継承階層
System.Object
   System.Exception
     System.SystemException
       System.MemberAccessException
         System.MissingMemberException
          System.MissingFieldException
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

MissingFieldException コンストラクタ ()

MissingFieldException クラスの新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As New MissingFieldException
public MissingFieldException ()
public:
MissingFieldException ()
public MissingFieldException ()
public function MissingFieldException ()
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MissingFieldException クラス
MissingFieldException メンバ
System 名前空間

MissingFieldException コンストラクタ (String)

指定したエラー メッセージを使用して、MissingFieldException クラスの新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim message As String

Dim instance As New MissingFieldException(message)
public MissingFieldException (
    string message
)
public:
MissingFieldException (
    String^ message
)
public MissingFieldException (
    String message
)
public function MissingFieldException (
    message : String
)

パラメータ

message

エラーを説明する String。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MissingFieldException クラス
MissingFieldException メンバ
System 名前空間

MissingFieldException コンストラクタ (String, String)

クラス名とフィールド名を指定して、MissingFieldException クラスの新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    className As String, _
    fieldName As String _
)
Dim className As String
Dim fieldName As String

Dim instance As New MissingFieldException(className,
 fieldName)
public MissingFieldException (
    string className,
    string fieldName
)
public:
MissingFieldException (
    String^ className, 
    String^ fieldName
)
public MissingFieldException (
    String className, 
    String fieldName
)
public function MissingFieldException (
    className : String, 
    fieldName : String
)

パラメータ

className

存在しないフィールドへのアクセスが試行されたクラスの名前。

fieldName

アクセスできないフィールドの名前。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MissingFieldException クラス
MissingFieldException メンバ
System 名前空間

MissingFieldException コンストラクタ (String, Exception)

指定したエラー メッセージと、この例外の原因である内部例外への参照を使用して、MissingFieldException クラスの新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説

前の例外の直接の結果としてスローされる例外については、InnerException プロパティに、前の例外への参照が格納されます。InnerException プロパティは、コンストラクタに渡されたものと同じ値を返します。InnerException プロパティによって内部例外値がコンストラクタに渡されなかった場合は、null 参照 (Visual Basic の場合は Nothing) を返します。

MissingFieldException のインスタンスの初期プロパティ値を次の表に示します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MissingFieldException クラス
MissingFieldException メンバ
System 名前空間
Exception クラス

MissingFieldException コンストラクタ (SerializationInfo, StreamingContext)

シリアル化したデータを使用して、MissingFieldException クラスの新しいインスタンスを初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New MissingFieldException(info,
 context)
protected MissingFieldException (
    SerializationInfo info,
    StreamingContext context
)
protected:
MissingFieldException (
    SerializationInfo^ info, 
    StreamingContext context
)
protected MissingFieldException (
    SerializationInfo info, 
    StreamingContext context
)
protected function MissingFieldException (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

シリアル化されたオブジェクト データを保持するオブジェクト。

context

転送元または転送先に関するコンテキスト情報。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

MissingFieldException コンストラクタ

MissingFieldException クラスの新しいインスタンスを初期化します。
オーバーロードの一覧オーバーロードの一覧

名前 説明
MissingFieldException () MissingFieldException クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

MissingFieldException (String) 指定したエラー メッセージを使用して、MissingFieldException クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

MissingFieldException (SerializationInfo, StreamingContext) シリアル化したデータを使用して、MissingFieldException クラスの新しいインスタンスを初期化します。
MissingFieldException (String, Exception) 指定したエラー メッセージと、この例外の原因である内部例外への参照を使用して、MissingFieldException クラスの新しいインスタンスを初期化します。

.NET Compact Framework によってサポートされています。

MissingFieldException (String, String) クラス名とフィールド名を指定して、MissingFieldException クラスの新しいインスタンスを初期化します。
参照参照

関連項目

MissingFieldException クラス
MissingFieldException メンバ
System 名前空間

MissingFieldException フィールド


プロテクト フィールドプロテクト フィールド

  名前 説明
プロテクト フィールド ClassName  存在しないメンバのクラス名を保持します。 ( MissingMemberException から継承されます。)
プロテクト フィールド MemberName  存在しないメンバの名前を保持します。 ( MissingMemberException から継承されます。)
プロテクト フィールド Signature  存在しないメンバのシグネチャを保持します。 ( MissingMemberException から継承されます。)
参照参照

関連項目

MissingFieldException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー

MissingFieldException プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外に割り当てられているコード化数値である HRESULT を取得または設定します。 ( Exception から継承されます。)
参照参照

関連項目

MissingFieldException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー

MissingFieldException メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

MissingFieldException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー

MissingFieldException メンバ

存在しないフィールドに動的にアクセスしようとした場合にスローされる例外。

MissingFieldException データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
プロテクト コンストラクタプロテクト コンストラクタ
  名前 説明
プロテクト メソッド MissingFieldException オーバーロードされます。 MissingFieldException クラスの新しいインスタンスを初期化します。
プロテクト フィールドプロテクト フィールド
  名前 説明
プロテクト フィールド ClassName  存在しないメンバのクラス名を保持します。(MissingMemberException から継承されます。)
プロテクト フィールド MemberName  存在しないメンバの名前を保持します。(MissingMemberException から継承されます。)
プロテクト フィールド Signature  存在しないメンバのシグネチャを保持します。(MissingMemberException から継承されます。)
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外に割り当てられているコード化数値である HRESULT を取得または設定します。(Exception から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

MissingFieldException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「MissingFieldException」の関連用語

MissingFieldExceptionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MissingFieldExceptionのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS