Share via


CodeThrowExceptionStatement Sınıf

Tanım

Özel durum oluşturan bir deyimi temsil eder.

public ref class CodeThrowExceptionStatement : System::CodeDom::CodeStatement
public class CodeThrowExceptionStatement : System.CodeDom.CodeStatement
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeThrowExceptionStatement : System.CodeDom.CodeStatement
type CodeThrowExceptionStatement = class
    inherit CodeStatement
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeThrowExceptionStatement = class
    inherit CodeStatement
Public Class CodeThrowExceptionStatement
Inherits CodeStatement
Devralma
CodeThrowExceptionStatement
Öznitelikler

Örnekler

Bu örnekte, yeni System.Exceptionbir oluşturmak için kullanma CodeThrowExceptionStatement gösterilmektedir.

// This CodeThrowExceptionStatement throws a new System.Exception.
array<CodeExpression^>^temp0;
CodeThrowExceptionStatement^ throwException = gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( gcnew CodeTypeReference( System::Exception::typeid ),temp0 ) );

// A C# code generator produces the following source code for the preceeding example code:
// throw new System.Exception();
// This CodeThrowExceptionStatement throws a new System.Exception.
CodeThrowExceptionStatement throwException = new CodeThrowExceptionStatement(
    // codeExpression parameter indicates the exception to throw.
    // You must use an object create expression to new an exception here.
    new CodeObjectCreateExpression(
    // createType parameter inidicates the type of object to create.
    new CodeTypeReference(typeof(System.Exception)),
    // parameters parameter indicates the constructor parameters.
    new CodeExpression[] {} ) );

// A C# code generator produces the following source code for the preceeding example code:

// throw new System.Exception();
 ' This CodeThrowExceptionStatement throws a new System.Exception.
 ' The codeExpression parameter indicates the exception to throw.
 ' You must use an object create expression to new an exception here.
 Dim throwException As New CodeThrowExceptionStatement( _
New CodeObjectCreateExpression( _
    New CodeTypeReference(GetType(System.Exception)), _
    New CodeExpression() {}))

 ' A Visual Basic code generator produces the following source code for the preceeding example code:

 ' Throw New System.Exception

Açıklamalar

CodeThrowExceptionStatement özel durum oluşturan bir deyimi temsil edebilir. İfade, sınıfından türetilen Exception bir türün örneğine başvuru olmalıdır veya bunu değerlendirmelidir.

ToThrow özelliği, atacak özel durumu belirtir.

Oluşturucular

CodeThrowExceptionStatement()

CodeThrowExceptionStatement sınıfının yeni bir örneğini başlatır.

CodeThrowExceptionStatement(CodeExpression)

Belirtilen özel durum türü örneğiyle sınıfının yeni bir örneğini CodeThrowExceptionStatement başlatır.

Özellikler

EndDirectives

Bitiş yönergelerini içeren bir CodeDirectiveCollection nesnesi alır.

(Devralındığı yer: CodeStatement)
LinePragma

Kod deyiminin oluştuğu satırı alır veya ayarlar.

(Devralındığı yer: CodeStatement)
StartDirectives

Başlangıç yönergelerini içeren bir CodeDirectiveCollection nesnesi alır.

(Devralındığı yer: CodeStatement)
ToThrow

Özel durumu atacak şekilde alır veya ayarlar.

UserData

Geçerli nesne için kullanıcı tarafından tanımlanabilir verileri alır.

(Devralındığı yer: CodeObject)

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır