NullReferenceException クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
null オブジェクト参照を逆参照しようとした場合にスローされる例外。
public ref class NullReferenceException : Exception
public ref class NullReferenceException : SystemException
public class NullReferenceException : Exception
public class NullReferenceException : SystemException
[System.Serializable]
public class NullReferenceException : SystemException
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class NullReferenceException : SystemException
type NullReferenceException = class
inherit Exception
type NullReferenceException = class
inherit SystemException
[<System.Serializable>]
type NullReferenceException = class
inherit SystemException
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type NullReferenceException = class
inherit SystemException
Public Class NullReferenceException
Inherits Exception
Public Class NullReferenceException
Inherits SystemException
- 継承
- 継承
- 属性
注釈
NullReferenceException値が である型のメンバーにアクセスしようとすると、例外がスローされますnull。 例外は NullReferenceException 通常、開発者エラーを反映し、次のシナリオでスローされます。
参照型をインスタンス化することを忘れました。 次の例では、
namesは宣言されていますが、インスタンス化されません。using System; using System.Collections.Generic; public class Example { public static void Main(string[] args) { int value = Int32.Parse(args[0]); List<String> names; if (value > 0) names = new List<String>(); names.Add("Major Major Major"); } } // Compilation displays a warning like the following: // Example1.cs(10) : warning BC42104: Variable //names// is used before it // has been assigned a value. A null reference exception could result // at runtime. // // names.Add("Major Major Major") // ~~~~~ // The example displays output like the following output: // Unhandled Exception: System.NullReferenceException: Object reference // not set to an instance of an object. // at Example.Main()open System [<EntryPoint>] let main args = let value = Int32.Parse args[0] // Set names to null, don't initialize it. let mutable names = Unchecked.defaultof<ResizeArray<string>> if value > 0 then names <- ResizeArray() names.Add "Major Major Major" 0 // Compilation does not display a warning as this is an extremely rare occurance in F#. // Creating a value without initalizing either requires using 'null' (not possible // on types defined in F# without [<AllowNullLiteral>]) or Unchecked.defaultof. // // The example displays output like the following output: // Unhandled Exception: System.NullReferenceException: Object reference // not set to an instance of an object. // at Example.main()Imports System.Collections.Generic Module Example Public Sub Main() Dim names As List(Of String) names.Add("Major Major Major") End Sub End Module ' Compilation displays a warning like the following: ' Example1.vb(10) : warning BC42104: Variable 'names' is used before it ' has been assigned a value. A null reference exception could result ' at runtime. ' ' names.Add("Major Major Major") ' ~~~~~ ' The example displays output like the following output: ' Unhandled Exception: System.NullReferenceException: Object reference ' not set to an instance of an object. ' at Example.Main()一部のコンパイラでは、このコードをコンパイルするときに警告が発行されます。 他のユーザーはエラーを発行し、コンパイルは失敗します。 この問題に対処するには、 オブジェクトをインスタンス化して、その値が でなくなっている
nullようにします。 次の例では、型のクラス コンストラクターを呼び出すことによってこれを行います。using System; using System.Collections.Generic; public class Example { public static void Main() { List<String> names = new List<String>(); names.Add("Major Major Major"); } }let names = ResizeArray() names.Add "Major Major Major"Imports System.Collections.Generic Module Example Public Sub Main() Dim names As New List(Of String)() names.Add("Major Major Major") End Sub End Module配列を初期化する前に、配列の次元を設定することを忘れてしまいました。 次の例では、
valuesは整数配列として宣言されていますが、含まれる要素の数は指定されていません。 したがって、その値を初期化しようとすると例外が NullReferenceException スローされます。using System; public class Example { public static void Main() { int[] values = null; for (int ctr = 0; ctr <= 9; ctr++) values[ctr] = ctr * 2; foreach (var value in values) Console.WriteLine(value); } } // The example displays the following output: // Unhandled Exception: // System.NullReferenceException: Object reference not set to an instance of an object. // at Example.Main()let values: int[] = null for i = 0 to 9 do values[i] <- i * 2 for value in values do printfn $"{value}" // The example displays the following output: // Unhandled Exception: // System.NullReferenceException: Object reference not set to an instance of an object. // at <StartupCode$fs>.main()Module Example Public Sub Main() Dim values() As Integer For ctr As Integer = 0 To 9 values(ctr) = ctr * 2 Next For Each value In values Console.WriteLine(value) Next End Sub End Module ' The example displays the following output: ' Unhandled Exception: ' System.NullReferenceException: Object reference not set to an instance of an object. ' at Example.Main()次の例のように、初期化する前に配列内の要素の数を宣言することで、例外を排除できます。
using System; public class Example { public static void Main() { int[] values = new int[10]; for (int ctr = 0; ctr <= 9; ctr++) values[ctr] = ctr * 2; foreach (var value in values) Console.WriteLine(value); } } // The example displays the following output: // 0 // 2 // 4 // 6 // 8 // 10 // 12 // 14 // 16 // 18let values = Array.zeroCreate<int> 10 for i = 0 to 9 do values[i] <- i * 2 for value in values do printfn $"{value}" // The example displays the following output: // 0 // 2 // 4 // 6 // 8 // 10 // 12 // 14 // 16 // 18Module Example Public Sub Main() Dim values(9) As Integer For ctr As Integer = 0 To 9 values(ctr) = ctr * 2 Next For Each value In values Console.WriteLine(value) Next End Sub End Module ' The example displays the following output: ' 0 ' 2 ' 4 ' 6 ' 8 ' 10 ' 12 ' 14 ' 16 ' 18メソッドから null の戻り値を取得し、返された型でメソッドを呼び出します。 これは、ドキュメント エラーの結果である場合があります。ドキュメントでは、メソッド呼び出しで を返
nullすことができることに注意できません。 それ以外の場合、コードでは、メソッドが常に null 以外の値を返すと誤って想定しています。次の例のコードでは、フィールドがArray.Find検索文字列と一致する
PersonFirstNameオブジェクトがメソッドによって常に返されることを前提としています。 一致しないため、ランタイムは例外を NullReferenceException スローします。using System; public class Example { public static void Main() { Person[] persons = Person.AddRange( new String[] { "Abigail", "Abra", "Abraham", "Adrian", "Ariella", "Arnold", "Aston", "Astor" } ); String nameToFind = "Robert"; Person found = Array.Find(persons, p => p.FirstName == nameToFind); Console.WriteLine(found.FirstName); } } public class Person { public static Person[] AddRange(String[] firstNames) { Person[] p = new Person[firstNames.Length]; for (int ctr = 0; ctr < firstNames.Length; ctr++) p[ctr] = new Person(firstNames[ctr]); return p; } public Person(String firstName) { this.FirstName = firstName; } public String FirstName; } // The example displays the following output: // Unhandled Exception: System.NullReferenceException: // Object reference not set to an instance of an object. // at Example.Main()open System type Person(firstName) = member _.FirstName = firstName static member AddRange(firstNames) = Array.map Person firstNames let persons = [| "Abigail"; "Abra"; "Abraham"; "Adrian" "Ariella"; "Arnold"; "Aston"; "Astor" |] |> Person.AddRange let nameToFind = "Robert" let found = Array.Find(persons, fun p -> p.FirstName = nameToFind) printfn $"{found.FirstName}" // The example displays the following output: // Unhandled Exception: System.NullReferenceException: // Object reference not set to an instance of an object. // at <StartupCode$fs>.main()Module Example Public Sub Main() Dim persons() As Person = Person.AddRange( { "Abigail", "Abra", "Abraham", "Adrian", "Ariella", "Arnold", "Aston", "Astor" } ) Dim nameToFind As String = "Robert" Dim found As Person = Array.Find(persons, Function(p) p.FirstName = nameToFind) Console.WriteLine(found.FirstName) End Sub End Module Public Class Person Public Shared Function AddRange(firstNames() As String) As Person() Dim p(firstNames.Length - 1) As Person For ctr As Integer = 0 To firstNames.Length - 1 p(ctr) = New Person(firstNames(ctr)) Next Return p End Function Public Sub New(firstName As String) Me.FirstName = firstName End Sub Public FirstName As String End Class ' The example displays the following output: ' Unhandled Exception: System.NullReferenceException: ' Object reference not set to an instance of an object. ' at Example.Main()この問題に対処するには、次の例に示すように、メソッドの戻り値をテストして、メンバーを呼び出す前にメソッドがないことを
null確認します。using System; public class Example { public static void Main() { Person[] persons = Person.AddRange( new String[] { "Abigail", "Abra", "Abraham", "Adrian", "Ariella", "Arnold", "Aston", "Astor" } ); String nameToFind = "Robert"; Person found = Array.Find(persons, p => p.FirstName == nameToFind); if (found != null) Console.WriteLine(found.FirstName); else Console.WriteLine("{0} not found.", nameToFind); } } public class Person { public static Person[] AddRange(String[] firstNames) { Person[] p = new Person[firstNames.Length]; for (int ctr = 0; ctr < firstNames.Length; ctr++) p[ctr] = new Person(firstNames[ctr]); return p; } public Person(String firstName) { this.FirstName = firstName; } public String FirstName; } // The example displays the following output: // Robert not foundopen System [<AllowNullLiteral>] type Person(firstName) = member _.FirstName = firstName static member AddRange(firstNames) = Array.map Person firstNames let persons = [| "Abigail"; "Abra"; "Abraham"; "Adrian" "Ariella"; "Arnold"; "Aston"; "Astor" |] |> Person.AddRange let nameToFind = "Robert" let found = Array.Find(persons, fun p -> p.FirstName = nameToFind) if found <> null then printfn $"{found.FirstName}" else printfn $"{nameToFind} not found." // Using F#'s Array.tryFind function // This does not require a null check or [<AllowNullLiteral>] let found2 = persons |> Array.tryFind (fun p -> p.FirstName = nameToFind) match found2 with | Some firstName -> printfn $"{firstName}" | None -> printfn $"{nameToFind} not found." // The example displays the following output: // Robert not found. // Robert not found.Module Example Public Sub Main() Dim persons() As Person = Person.AddRange( { "Abigail", "Abra", "Abraham", "Adrian", "Ariella", "Arnold", "Aston", "Astor" } ) Dim nameToFind As String = "Robert" Dim found As Person = Array.Find(persons, Function(p) p.FirstName = nameToFind) If found IsNot Nothing Then Console.WriteLine(found.FirstName) Else Console.WriteLine("{0} not found.", nameToFind) End If End Sub End Module Public Class Person Public Shared Function AddRange(firstNames() As String) As Person() Dim p(firstNames.Length - 1) As Person For ctr As Integer = 0 To firstNames.Length - 1 p(ctr) = New Person(firstNames(ctr)) Next Return p End Function Public Sub New(firstName As String) Me.FirstName = firstName End Sub Public FirstName As String End Class ' The example displays the following output: ' Robert not found式 (たとえば、メソッドまたはプロパティの一覧を連結して) を使用して値を取得し、値
nullが であるかどうかを確認しているにもかかわらず、ランタイムは例外を NullReferenceException スローします。 これは、式の中間値の 1 つが を返nullすからです。 その結果、 のnullテストは評価されません。次の例では、
PagesオブジェクトによってPage表示される Web ページに関する情報をキャッシュする オブジェクトを定義します。 メソッドはExample.Main、現在の Web ページに null 以外のタイトルがあるかどうかを確認し、存在する場合はタイトルを表示します。 ただし、このチェックにもかかわらず、 メソッドは例外をNullReferenceExceptionスローします。using System; public class Example { public static void Main() { var pages = new Pages(); if (! String.IsNullOrEmpty(pages.CurrentPage.Title)) { String title = pages.CurrentPage.Title; Console.WriteLine("Current title: '{0}'", title); } } } public class Pages { Page[] page = new Page[10]; int ctr = 0; public Page CurrentPage { get { return page[ctr]; } set { // Move all the page objects down to accommodate the new one. if (ctr > page.GetUpperBound(0)) { for (int ndx = 1; ndx <= page.GetUpperBound(0); ndx++) page[ndx - 1] = page[ndx]; } page[ctr] = value; if (ctr < page.GetUpperBound(0)) ctr++; } } public Page PreviousPage { get { if (ctr == 0) { if (page[0] == null) return null; else return page[0]; } else { ctr--; return page[ctr + 1]; } } } } public class Page { public Uri URL; public String Title; } // The example displays the following output: // Unhandled Exception: // System.NullReferenceException: Object reference not set to an instance of an object. // at Example.Main()open System type Page() = [<DefaultValue>] val mutable public URL: Uri [<DefaultValue>] val mutable public Title: string type Pages() = let pages = Array.zeroCreate<Page> 10 let mutable i = 0 member _.CurrentPage with get () = pages[i] and set (value) = // Move all the page objects down to accommodate the new one. if i > pages.GetUpperBound 0 then for ndx = 1 to pages.GetUpperBound 0 do pages[ndx - 1] <- pages[ndx] pages[i] <- value if i < pages.GetUpperBound 0 then i <- i + 1 member _.PreviousPage = if i = 0 then if box pages[0] = null then Unchecked.defaultof<Page> else pages[0] else i <- i - 1 pages[i + 1] let pages = Pages() if String.IsNullOrEmpty pages.CurrentPage.Title |> not then let title = pages.CurrentPage.Title printfn $"Current title: '{title}'" // The example displays the following output: // Unhandled Exception: // System.NullReferenceException: Object reference not set to an instance of an object. // at <StartupCode$fs>.main()Module Example Public Sub Main() Dim pages As New Pages() Dim title As String = pages.CurrentPage.Title End Sub End Module Public Class Pages Dim page(9) As Page Dim ctr As Integer = 0 Public Property CurrentPage As Page Get Return page(ctr) End Get Set ' Move all the page objects down to accommodate the new one. If ctr > page.GetUpperBound(0) Then For ndx As Integer = 1 To page.GetUpperBound(0) page(ndx - 1) = page(ndx) Next End If page(ctr) = value If ctr < page.GetUpperBound(0) Then ctr += 1 End Set End Property Public ReadOnly Property PreviousPage As Page Get If ctr = 0 Then If page(0) Is Nothing Then Return Nothing Else Return page(0) End If Else ctr -= 1 Return page(ctr + 1) End If End Get End Property End Class Public Class Page Public URL As Uri Public Title As String End Class ' The example displays the following output: ' Unhandled Exception: ' System.NullReferenceException: Object reference not set to an instance of an object. ' at Example.Main()キャッシュにページ情報が格納されていない場合は が返
nullされるためpages.CurrentPage、例外がスローされます。 この例外は、次の例のように、現在PageのオブジェクトのCurrentPageプロパティを取得する前に プロパティのTitle値をテストすることで修正できます。using System; public class Example { public static void Main() { var pages = new Pages(); Page current = pages.CurrentPage; if (current != null) { String title = current.Title; Console.WriteLine("Current title: '{0}'", title); } else { Console.WriteLine("There is no page information in the cache."); } } } // The example displays the following output: // There is no page information in the cache.let pages = Pages() let current = pages.CurrentPage if box current <> null then let title = current.Title printfn $"Current title: '{title}'" else printfn "There is no page information in the cache." // The example displays the following output: // There is no page information in the cache.Module Example Public Sub Main() Dim pages As New Pages() Dim current As Page = pages.CurrentPage If current IsNot Nothing Then Dim title As String = current.Title Console.WriteLine("Current title: '{0}'", title) Else Console.WriteLine("There is no page information in the cache.") End If End Sub End Module ' The example displays the following output: ' There is no page information in the cache.参照型を含む配列の要素を列挙すると、いずれかの要素を処理しようとすると例外が NullReferenceException スローされます。
次の例では、文字列配列を定義します。 ステートメントは
for配列内の要素を列挙し、文字列を表示する前に各文字列の Trim メソッドを呼び出します。using System; public class Example { public static void Main() { String[] values = { "one", null, "two" }; for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++) Console.Write("{0}{1}", values[ctr].Trim(), ctr == values.GetUpperBound(0) ? "" : ", "); Console.WriteLine(); } } // The example displays the following output: // Unhandled Exception: // System.NullReferenceException: Object reference not set to an instance of an object. // at Example.Main()open System let values = [| "one"; null; "two" |] for i = 0 to values.GetUpperBound 0 do printfn $"""{values[i].Trim()}{if i = values.GetUpperBound 0 then "" else ", "}""" printfn "" // The example displays the following output: // Unhandled Exception: // System.NullReferenceException: Object reference not set to an instance of an object. // at <StartupCode$fs>.main()Module Example Public Sub Main() Dim values() As String = { "one", Nothing, "two" } For ctr As Integer = 0 To values.GetUpperBound(0) Console.Write("{0}{1}", values(ctr).Trim(), If(ctr = values.GetUpperBound(0), "", ", ")) Next Console.WriteLine() End Sub End Module ' The example displays the following output: ' Unhandled Exception: System.NullReferenceException: ' Object reference not set to an instance of an object. ' at Example.Main()この例外は、配列の各要素に null 以外の値が含まれている必要があり、配列要素の値が 実際
nullには である場合に発生します。 次の例に示すように、その要素nullに対して操作を実行する前に 要素があるかどうかをテストすることで、例外を排除できます。using System; public class Example { public static void Main() { String[] values = { "one", null, "two" }; for (int ctr = 0; ctr <= values.GetUpperBound(0); ctr++) Console.Write("{0}{1}", values[ctr] != null ? values[ctr].Trim() : "", ctr == values.GetUpperBound(0) ? "" : ", "); Console.WriteLine(); } } // The example displays the following output: // one, , twoopen System let values = [| "one"; null; "two" |] for i = 0 to values.GetUpperBound 0 do printf $"""{if values[i] <> null then values[i].Trim() else ""}{if i = values.GetUpperBound 0 then "" else ", "}""" Console.WriteLine() // The example displays the following output: // one, , twoModule Example Public Sub Main() Dim values() As String = { "one", Nothing, "two" } For ctr As Integer = 0 To values.GetUpperBound(0) Console.Write("{0}{1}", If(values(ctr) IsNot Nothing, values(ctr).Trim(), ""), If(ctr = values.GetUpperBound(0), "", ", ")) Next Console.WriteLine() End Sub End Module ' The example displays the following output: ' one, , two例外は NullReferenceException 、いずれかの引数のメンバーにアクセスするときにメソッドによってスローされますが、その引数は です
null。 次の例の メソッドはPopulateNames、 行で例外をスローしますnames.Add(arrName);。using System; using System.Collections.Generic; public class Example { public static void Main() { List<String> names = GetData(); PopulateNames(names); } private static void PopulateNames(List<String> names) { String[] arrNames = { "Dakota", "Samuel", "Nikita", "Koani", "Saya", "Yiska", "Yumaevsky" }; foreach (var arrName in arrNames) names.Add(arrName); } private static List<String> GetData() { return null; } } // The example displays output like the following: // Unhandled Exception: System.NullReferenceException: Object reference // not set to an instance of an object. // at Example.PopulateNames(List`1 names) // at Example.Main()let populateNames (names: ResizeArray<string>) = let arrNames = [ "Dakota"; "Samuel"; "Nikita" "Koani"; "Saya"; "Yiska"; "Yumaevsky" ] for arrName in arrNames do names.Add arrName let getData () : ResizeArray<string> = null let names = getData () populateNames names // The example displays output like the following: // Unhandled Exception: System.NullReferenceException: Object reference // not set to an instance of an object. // at Example.PopulateNames(List`1 names) // at <StartupCode$fs>.main()Imports System.Collections.Generic Module Example Public Sub Main() Dim names As List(Of String) = GetData() PopulateNames(names) End Sub Private Sub PopulateNames(names As List(Of String)) Dim arrNames() As String = { "Dakota", "Samuel", "Nikita", "Koani", "Saya", "Yiska", "Yumaevsky" } For Each arrName In arrNames names.Add(arrName) Next End Sub Private Function GetData() As List(Of String) Return Nothing End Function End Module ' The example displays output like the following: ' Unhandled Exception: System.NullReferenceException: Object reference ' not set to an instance of an object. ' at Example.PopulateNames(List`1 names) ' at Example.Main()この問題に対処するには、メソッドに渡される引数が でないことを
null確認するか、ブロックでスローされた例外をtry…catch…finally処理します。 詳細については、「 例外で定義されているインターフェイスのプライベート C++ 固有の実装です。
次の Microsoft 中間言語 (MSIL) の手順では、、、、、cpobj、、ldfldastelem.<type>ldelem.<type>ldfldstind.<type>throwldelemaldlenldind.<type>initblkstfldおよび がスローNullReferenceExceptionされます。unboxcpblkcallvirt
NullReferenceException では、0X80004003値を持つ HRESULT COR_E_NULLREFERENCEを使用します。
インスタンスの初期プロパティ値の一覧についてはNullReferenceExceptionを参照してください、NullReferenceExceptionコンス トラクター。
リリース コードでの NullReferenceException の処理
通常、NullReferenceException は発生後に処理するよりも回避することをお勧めします。 例外の処理によって、コードは管理や理解が難しくなることがあるうえ、他のバグが生じることも考えられます。 NullReferenceException は多くの場合、回復不能なエラーです。 こうした場合、例外によってアプリを停止させることが最良の代替策である可能性があります。
ただし、次のように、エラーの処理が有用である状況は多く存在します。
アプリは null であるオブジェクトを無視できます。 たとえば、アプリがデータベース内のレコードを取得して処理する場合、結果として null オブジェクトである、いくつかの不良レコードを無視できる可能性があります。 必要な処理は、ログ ファイルまたはアプリケーションの UI に不良データを記録することだけであることが考えられます。
例外から回復することができます。 たとえば、参照型を返す Web サービスの呼び出しでは、接続が失われたり、接続がタイムアウトした場合に null が返されることがあります。接続の再確立を試み、もう一度呼び出しを試みることができます。
アプリの状態を有効な状態に復元できます。 たとえば、NullReferenceException をスローするメソッドを呼び出す前に、情報をデータ ストアに保存する必要がある、複数手順のタスクを実行していることがあります。 初期化されていないオブジェクトがデータ レコードを破損する可能性がある場合、アプリを終了する前に過去のデータを削除できます。
例外の報告が推奨されます。 たとえば、アプリのユーザーからの間違いが原因でエラーが発生した場合は、正しい情報を提供するのに役立つメッセージを生成できます。 問題の解決に役立てるために、エラーに関する情報をログに記録することもできます。 ASP.NET などのいくつかのフレームワークには、アプリのクラッシュを防止するために、すべてのエラーをキャプチャする上位レベルの例外ハンドラーが用意されています。このハンドラーを使用した場合、例外をログに記録することが、その例外が発生したことを知る唯一の方法になる可能性があります。
コンストラクター
| NullReferenceException() |
クラスの新しいインスタンスを NullReferenceException 初期化し、新しいインスタンスの プロパティを、"オブジェクトのインスタンスが必要な場所で値 'null' が見つかりました" などのエラーを説明するシステム指定のメッセージに設定 Message します。このメッセージでは、現在のシステム カルチャが考慮されます。 |
| NullReferenceException(SerializationInfo, StreamingContext) |
古い.
シリアル化したデータを使用して、NullReferenceException クラスの新しいインスタンスを初期化します。 |
| NullReferenceException(String) |
指定したエラー メッセージを使用して、NullReferenceException クラスの新しいインスタンスを初期化します。 |
| NullReferenceException(String, Exception) |
指定したエラー メッセージおよびこの例外の原因となった内部例外への参照を使用して、NullReferenceException クラスの新しいインスタンスを初期化します。 |
プロパティ
| Data |
例外に関する追加のユーザー定義情報を提供する、キーと値のペアのコレクションを取得します。 (継承元 Exception) |
| HelpLink |
この例外に関連付けられているヘルプ ファイルへのリンクを取得または設定します。 (継承元 Exception) |
| HResult |
特定の例外に割り当てられているコード化数値である HRESULT を取得または設定します。 (継承元 Exception) |
| InnerException |
現在の例外の原因となる Exception インスタンスを取得します。 (継承元 Exception) |
| Message |
現在の例外を説明するメッセージを取得します。 (継承元 Exception) |
| Source |
エラーの原因となるアプリケーションまたはオブジェクトの名前を取得または設定します。 (継承元 Exception) |
| StackTrace |
呼び出し履歴で直前のフレームの文字列形式を取得します。 (継承元 Exception) |
| TargetSite |
現在の例外がスローされたメソッドを取得します。 (継承元 Exception) |
メソッド
| Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetBaseException() |
派生クラスでオーバーライドされた場合、それ以後に発生する 1 つ以上の例外の根本原因である Exception を返します。 (継承元 Exception) |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetObjectData(SerializationInfo, StreamingContext) |
古い.
派生クラスでオーバーライドされた場合は、その例外に関する情報を使用して SerializationInfo を設定します。 (継承元 Exception) |
| GetType() |
現在のインスタンスのランタイム型を取得します。 (継承元 Exception) |
| MemberwiseClone() |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
| ToString() |
現在の例外の文字列形式を作成して返します。 (継承元 Exception) |
イベント
| SerializeObjectState |
古い.
例外がシリアル化され、例外に関するシリアル化されたデータを含む例外状態オブジェクトが作成されたときに発生します。 (継承元 Exception) |