基本クラスの参照を表します。
名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文
'宣言
<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeBaseReferenceExpression
Inherits CodeExpression
'使用
Dim instance As CodeBaseReferenceExpression
[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class CodeBaseReferenceExpression : CodeExpression
[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
[ComVisibleAttribute(true)]
public ref class CodeBaseReferenceExpression : public CodeExpression
/** @attribute SerializableAttribute() */
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
/** @attribute ComVisibleAttribute(true) */
public class CodeBaseReferenceExpression extends CodeExpression
SerializableAttribute
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
ComVisibleAttribute(true)
public class CodeBaseReferenceExpression extends CodeExpression
解説
CodeBaseReferenceExpression は、現在のクラスの基本クラスへの参照を表します。基本クラスは、親クラスまたはスーパークラスと呼ばれることもあります。通常、基本クラスの参照は、メソッドまたはプロパティをオーバーライドしてそのメソッドまたはプロパティの基本クラスの実装を呼び出す場合に使用されます。たとえば、C# では、基本クラスの ToString メソッドの末尾に文字列を追加する ToString メソッドのオーバーライドは base.ToString() を呼び出します。
使用例
CodeBaseReferenceExpression を使用して、基本クラスのメソッドを参照する例を次に示します。
' Example method invoke expression uses CodeBaseReferenceExpression to produce
' a base.Dispose method call
Dim methodInvokeExpression As New CodeMethodInvokeExpression( New CodeBaseReferenceExpression(), "Dispose", New CodeExpression() {})
' A Visual Basic code generator produces the following source code for the preceeding example code:
' MyBase.Dispose
// Example method invoke expression uses CodeBaseReferenceExpression to produce
// a base.Dispose method call
CodeMethodInvokeExpression methodInvokeExpression =
// Creates a method invoke expression
new CodeMethodInvokeExpression(
// targetObject parameter can be a
// base class reference
new CodeBaseReferenceExpression(),
// Method name and method parameter arguments
"Dispose", new CodeExpression[] {});
// A C# code generator produces the following source code for the preceeding example code:
// base.Dispose();
// Example method invoke expression uses CodeBaseReferenceExpression to produce
// a base.Dispose method call
CodeMethodInvokeExpression^ methodInvokeExpression =
gcnew CodeMethodInvokeExpression( // Creates a method invoke expression
gcnew CodeBaseReferenceExpression, // targetObjectparameter can be a base class reference
"Dispose",gcnew array<CodeExpression^>{} ); // Method name and method parameter arguments
// A C# code generator produces the following source code for the preceeding example code:
// base.Dispose();
// Example method invoke expression uses CodeBaseReferenceExpression
// to produce
// a base.Dispose method call
CodeMethodInvokeExpression methodInvokeExpression =
// Creates a method invoke expression
new CodeMethodInvokeExpression(
// targetObject parameter can be a
// base class reference
new CodeBaseReferenceExpression(),
// Method name and method parameter arguments
"Dispose", new CodeExpression[]{});
// A VJ# code generator produces the following source code for the
// preceeding example code:
// super.Dispose();
継承階層
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeBaseReferenceExpression
スレッド セーフ
この型の 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