AmbiguousMatchException クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class AmbiguousMatchException Inherits SystemException
[SerializableAttribute] [ComVisibleAttribute(true)] public sealed class AmbiguousMatchException : SystemException
[SerializableAttribute] [ComVisibleAttribute(true)] public ref class AmbiguousMatchException sealed : public SystemException

AmbiguousMatchException は、値 0x8000211D を保持する HRESULT COR_E_AMBIGUOUSMATCH を使用します。
メンバが遅延バインディングで呼び出され、バインディング基準を満たすオーバーロードが複数存在した場合、または、単一の結果のみを返すリフレクション メソッド (System.Type.GetMethod や System.Type.GetProperty など) に渡されたバインディング基準に複数のメンバが一致した場合、AmbiguousMatchException がスローされます。

System.Exception
System.SystemException
System.Reflection.AmbiguousMatchException


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AmbiguousMatchException コンストラクタ ()
アセンブリ: mscorlib (mscorlib.dll 内)



Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AmbiguousMatchException コンストラクタ (String)
アセンブリ: mscorlib (mscorlib.dll 内)



Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AmbiguousMatchException コンストラクタ

名前 | 説明 |
---|---|
AmbiguousMatchException () | 空のメッセージ文字列を使用し、主要原因となる例外を null 参照 (Visual Basic では Nothing) に設定して、AmbiguousMatchException クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
AmbiguousMatchException (String) | メッセージ文字列セットを特定のメッセージに、主要原因となる例外を null 参照 (Visual Basic では Nothing) に設定して、AmbiguousMatchException クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |
AmbiguousMatchException (String, Exception) | 指定したエラー メッセージと、この例外の原因である内部例外への参照を使用して、AmbiguousMatchException クラスの新しいインスタンスを初期化します。 .NET Compact Framework によってサポートされています。 |

関連項目
AmbiguousMatchException クラスAmbiguousMatchException メンバ
System.Reflection 名前空間
Exception
SystemException
AmbiguousMatchException コンストラクタ (String, Exception)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim message As String Dim inner As Exception Dim instance As New AmbiguousMatchException(message, inner)

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

Mymethod という名前の 2 つのクラスを次の例で示します。一方のクラスは整数をとり、もう一方のクラスは文字列をとります。整数が Mymethod に渡されると、最初のクラスが使用されます。文字列が渡された場合は、2 番目のクラスが使用されます。どちらの Mymethod を使用するか判断できない場合は、AmbiguousMatchException がスローされます。
Class Myambiguous 'The first overload is typed to an Int32 Overloads Public Shared Sub Mymethod(number As Int32) Console.Write(ControlChars.Cr + "{0}", "I am from Int32 method") End Sub 'Mymethod 'The second overload is typed to a string Overloads Public Shared Sub Mymethod(alpha As String) Console.Write(ControlChars.Cr + "{0}", "I am from a string.") End Sub 'Mymethod Public Shared Sub Main() Try 'The following does not cause as exception Mymethod(2) ' goes to Mymethod (Int32) Mymethod("3") ' goes to Mymethod (string) Dim Mytype As Type = Type.GetType("Myambiguous") Dim Mymethodinfo32 As MethodInfo = Mytype.GetMethod("Mymethod", New Type() {GetType(Int32)}) Dim Mymethodinfostr As MethodInfo = Mytype.GetMethod("Mymethod", New Type() {GetType(System.String)}) 'Invoke a method, utilizing a Int32 integer Mymethodinfo32.Invoke(Nothing, New Object() {2}) 'Invoke the method utilizing a string Mymethodinfostr.Invoke(Nothing, New Object() {"1"}) 'The following line causes an ambiguious exception Dim Mymethodinfo As MethodInfo = Mytype.GetMethod("Mymethod") ' end of try block Catch theException As System.Reflection.AmbiguousMatchException Console.Write(ControlChars.Cr & "AmbiguousMatchException message - {0}", theException.Message) Catch End Try Return End Sub 'Main End Class 'Myambiguous 'This code produces the following output: 'I am from Int32 method 'I am from a string. 'I am from Int32 method 'I am from a string. 'AmbiguousMatchException message - Ambiguous match found.
class Myambiguous { //The first overload is typed to an Int32 public static void Mymethod (Int32 number){ Console.Write("\n{0}", "I am from Int32 method"); } //The second overload is typed to a string public static void Mymethod (string alpha) { Console.Write("\n{0}", "I am from a string."); } public static void Main() { try { //The following does not cause as exception Mymethod (2); // goes to Mymethod (Int32) Mymethod ("3"); // goes to Mymethod (string) Type Mytype = Type.GetType("Myambiguous"); MethodInfo Mymethodinfo32 = Mytype.GetMethod("Mymethod", new Type[]{typeof(Int32)}); MethodInfo Mymethodinfostr = Mytype.GetMethod("Mymethod", new Type[]{typeof(System.String)}); //Invoke a method, utilizing a Int32 integer Mymethodinfo32.Invoke(null, new Object[]{2}); //Invoke the method utilizing a string Mymethodinfostr.Invoke(null, new Object[]{"1"}); //The following line causes an ambiguious exception MethodInfo Mymethodinfo = Mytype.GetMethod("Mymethod"); } // end of try block catch(System.Reflection.AmbiguousMatchException theException) { Console.Write("\nAmbiguousMatchException message - {0}", theException.Message); } catch { Console.Write("\nError thrown"); } return; } } //This code produces the following output: //I am from Int32 method //I am from a string. //I am from Int32 method //I am from a string. //AmbiguousMatchException message - Ambiguous match found.
ref class Myambiguous { public: //The first overload is typed to an Int32 static void Mymethod( Int32 number ) { Console::Write( "\nI am from Int32 method" ); } //The second overload is typed to a String* static void Mymethod( String^ alpha ) { Console::Write( "\nI am from a String*." ); } static void main() { try { //The following does not cause as exception Mymethod( 2 ); // goes to Mymethod (Int32) Mymethod( "3" ); // goes to Mymethod (String*) Type^ Mytype = Type::GetType( "Myambiguous" ); array<Type^>^temp0 = {Int32::typeid}; MethodInfo^ Mymethodinfo32 = Mytype->GetMethod( "Mymethod", temp0 ); array<Type^>^temp1 = {System::String::typeid}; MethodInfo^ Mymethodinfostr = Mytype->GetMethod( "Mymethod", temp1 ); //Invoke a method, utilizing a Int32 integer array<Object^>^temp2 = {2}; Mymethodinfo32->Invoke( nullptr, temp2 ); //Invoke the method utilizing a String* array<Object^>^temp3 = {"1"}; Mymethodinfostr->Invoke( nullptr, temp3 ); //The following line causes an ambiguous exception MethodInfo^ Mymethodinfo = Mytype->GetMethod( "Mymethod" ); } catch ( System::Reflection::AmbiguousMatchException^ theException ) { Console::Write( "\nAmbiguousMatchException message - {0}", theException->Message ); } catch ( Exception^ ) { Console::Write( "\nError thrown" ); } return; } }; int main() { Myambiguous::main(); } //This code produces the following output: //I am from Int32 method //I am from a String*. //I am from Int32 method //I am from a String*. //AmbiguousMatchException message - Ambiguous match found.
class MyAmbiguous { //The first overload is typed to an Int32 public static void MyMethod(Integer number) { Console.Write("\n{0}", "I am from Int32 method"); } //MyMethod //The second overload is typed to a string public static void MyMethod(String alpha) { Console.Write("\n{0}", "I am from a string."); } //MyMethod public static void main(String[] args) { try { //The following does not cause as exception MyMethod(new Integer(2)); // goes to MyMethod (Int32) MyMethod("3"); // goes to MyMethod (string) Type myType = Type.GetType("MyAmbiguous"); MethodInfo myMethodInfo32 = myType.GetMethod("MyMethod", new Type[] { Integer.class.ToType() }); MethodInfo myMethodInfoStr = myType.GetMethod("MyMethod", new Type[] { String.class.ToType() }); //Invoke a method, utilizing a Int32 integer myMethodInfo32.Invoke(null, new Object[] { new Integer(2) }); //Invoke the method utilizing a string myMethodInfoStr.Invoke(null, new Object[] { "1" }); //The following line causes an ambiguious exception MethodInfo myMethodInfo = myType.GetMethod("MyMethod"); } // end of try block catch (System.Reflection.AmbiguousMatchException theException) { Console.Write("\nAmbiguousMatchException message - {0}", theException.get_Message()); } catch (System.Exception exp) { Console.Write("\nError thrown"); } return; } //main } //MyAmbiguous //This code produces the following output: //I am from Int32 method //I am from a string. //I am from Int32 method //I am from a string. //AmbiguousMatchException message - Ambiguous match found.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


AmbiguousMatchException プロパティ

名前 | 説明 | |
---|---|---|
![]() | Data | 例外に関する追加のユーザー定義情報を提供するキー/値ペアのコレクションを取得します。 ( Exception から継承されます。) |
![]() | HelpLink | 例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。 ( Exception から継承されます。) |
![]() | InnerException | 現在の例外を発生させた Exception インスタンスを取得します。 ( Exception から継承されます。) |
![]() | Message | 現在の例外を説明するメッセージを取得します。 ( Exception から継承されます。) |
![]() | Source | エラーの原因となったアプリケーションまたはオブジェクトの名前を取得または設定します。 ( Exception から継承されます。) |
![]() | StackTrace | 現在の例外がスローされたときにコール スタックにあったフレームの文字列形式を取得します。 ( Exception から継承されます。) |
![]() | TargetSite | 現在の例外をスローするメソッドを取得します。 ( Exception から継承されます。) |

AmbiguousMatchException メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetBaseException | 派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の主要な原因である Exception を返します。 ( Exception から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetObjectData | 派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo を設定します。 ( Exception から継承されます。) |
![]() | GetType | 現在のインスタンスのランタイム型を取得します。 ( Exception から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の例外の文字列形式を作成して返します。 ( Exception から継承されます。) |

AmbiguousMatchException メンバ
メンバへのバインド時に、バインディング基準に一致するメンバが複数ある場合にスローされる例外。このクラスは継承できません。
AmbiguousMatchException データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Data | 例外に関する追加のユーザー定義情報を提供するキー/値ペアのコレクションを取得します。(Exception から継承されます。) |
![]() | HelpLink | 例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。(Exception から継承されます。) |
![]() | InnerException | 現在の例外を発生させた Exception インスタンスを取得します。(Exception から継承されます。) |
![]() | Message | 現在の例外を説明するメッセージを取得します。(Exception から継承されます。) |
![]() | Source | エラーの原因となったアプリケーションまたはオブジェクトの名前を取得または設定します。(Exception から継承されます。) |
![]() | StackTrace | 現在の例外がスローされたときにコール スタックにあったフレームの文字列形式を取得します。(Exception から継承されます。) |
![]() | TargetSite | 現在の例外をスローするメソッドを取得します。(Exception から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetBaseException | 派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の主要な原因である Exception を返します。 (Exception から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetObjectData | 派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo を設定します。 (Exception から継承されます。) |
![]() | GetType | 現在のインスタンスのランタイム型を取得します。 (Exception から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の例外の文字列形式を作成して返します。 (Exception から継承されます。) |

Weblioに収録されているすべての辞書からAmbiguousMatchExceptionを検索する場合は、下記のリンクをクリックしてください。

- AmbiguousMatchExceptionのページへのリンク