現在のローカル クラスのインスタンスへの参照を表します。
名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文
'宣言
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class CodeThisReferenceExpression
Inherits CodeExpression
'使用
Dim instance As CodeThisReferenceExpression
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
public class CodeThisReferenceExpression : CodeExpression
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
public ref class CodeThisReferenceExpression : public CodeExpression
/** @attribute SerializableAttribute() */
/** @attribute ComVisibleAttribute(true) */
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
public class CodeThisReferenceExpression extends CodeExpression
SerializableAttribute
ComVisibleAttribute(true)
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
public class CodeThisReferenceExpression extends CodeExpression
解説
これを使用して、"this" または "me" から参照されるクラス オブジェクトを表すことができます。
使用例
CodeThisReferenceExpression を使用して、現在のオブジェクトを参照する方法については、次のコード例を参照してください。
' Invokes the TestMethod method of the current type object.
Dim methodRef1 As New CodeMethodReferenceExpression(New CodeThisReferenceExpression(), "TestMethod")
Dim invoke1 As New CodeMethodInvokeExpression(methodRef1, New CodeParameterDeclarationExpression() {})
' A Visual Basic code generator produces the following source code for the preceeding example code:
' Me.TestMethod
// Invokes the TestMethod method of the current type object.
CodeMethodReferenceExpression methodRef1 = new CodeMethodReferenceExpression( new CodeThisReferenceExpression(), "TestMethod" );
CodeMethodInvokeExpression invoke1 = new CodeMethodInvokeExpression( methodRef1, new CodeParameterDeclarationExpression[] {} );
// A C# code generator produces the following source code for the preceeding example code:
// this.TestMethod();
// Invokes the TestMethod method of the current type object.
CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" );
array<CodeParameterDeclarationExpression^>^temp1;
CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp1 );
// A C# code generator produces the following source code for the preceeding example code:
// this.TestMethod();
// Invokes the TestMethod method of the current type object.
CodeMethodReferenceExpression methodRef1 = new
CodeMethodReferenceExpression(new CodeThisReferenceExpression(),
"TestMethod");
CodeMethodInvokeExpression invoke1 = new
CodeMethodInvokeExpression(methodRef1, new
CodeParameterDeclarationExpression[]{});
// A VJ# code generator produces the following source code for the
// preceeding example code:
// this.TestMethod();
継承階層
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeThisReferenceExpression
スレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0