CodeMethodReturnStatement
メンバ
コンストラクタ
- public CodeMethodReturnStatement();
-
- 概要
- System.CodeDom.CodeMethodReturnStatement クラスの新しいインスタンスを初期化します。
- public CodeMethodReturnStatement( CodeExpression expression );
-
- 概要
- 指定した式を使用して、System.CodeDom.CodeMethodReturnStatement クラスの新しいインスタンスを初期化します。
- パラメーター
-
- expression
- A System.CodeDom.CodeExpression を示す戻り値。
プロパティ
- public CodeExpression Expression{ get; set; }
-
- 概要
- 戻り値を取得または設定します。
- 戻り値
- A System.CodeDom.CodeExpression に return ステートメントに返す値を示すまたは null ステートメントが、サブルーチンの一部である場合。
- EndDirectives
- 終了ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。 (Inherited from CodeStatement )
- LinePragma
- コード ステートメントのある行を取得または設定します。 (Inherited from CodeStatement )
- StartDirectives
- 開始ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。 (Inherited from CodeStatement )
- UserData
- 現在のオブジェクトのユーザー定義可能なデータを取得します。 (Inherited from CodeObject )
メソッド
- Equals(Object)
- 指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。 (Inherited from Object)
- GetHashCode()
- 既定のハッシュ関数として機能します。 (Inherited from Object)
- GetType()
- 現在のインスタンスの Type を取得します。 (Inherited from Object)
- MemberwiseClone()
- 現在の Object の簡易コピーを作成します。 (Inherited from Object)
- ToString()
- 現在のオブジェクトを表す文字列を返します。 (Inherited from Object)
例
次の例での使用、CodeMethodReturnStatementメソッドから値を返すにします。
// Defines a method that returns a string passed to it.
// それに手渡されたストリングを戻す方法を定義する。
CodeMemberMethod method1 = new CodeMemberMethod();
method1.Name = "ReturnString";
method1.ReturnType = new CodeTypeReference("System.String");
method1.Parameters.Add( new CodeParameterDeclarationExpression("System.String", "text") );
method1.Statements.Add(
new CodeMethodReturnStatement(
new CodeArgumentReferenceExpression("text")
)
);
// A C# code generator produces the following source code for the preceeding example code:
// A C#コードジェネレータはpreceeding例コードのための以下のソースコードを作り出す:
// private string ReturnString(string text)
// {
// return text;
// }
定義
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeMethodReturnStatement : System.CodeDom.CodeStatement
クラス
#region アセンブリ System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:¥Program Files (x86)¥Reference Assemblies¥Microsoft¥Framework¥.NETFramework¥v4.6.1¥System.dll
#endregion
using System.Runtime.InteropServices;
namespace System.CodeDom
{
//
// 概要:
// 戻り値のステートメントを表します。
[ClassInterface( ClassInterfaceType.AutoDispatch )]
[ComVisible( true )]
public class CodeMethodReturnStatement : CodeStatement
{
//
// 概要:
// System.CodeDom.CodeMethodReturnStatement クラスの新しいインスタンスを初期化します。
public CodeMethodReturnStatement();
//
// 概要:
// 指定した式を使用して、System.CodeDom.CodeMethodReturnStatement クラスの新しいインスタンスを初期化します。
//
// パラメーター:
// expression:
// A System.CodeDom.CodeExpression を示す戻り値。
public CodeMethodReturnStatement( CodeExpression expression );
//
// 概要:
// 取得または戻り値を設定します。
//
// 戻り値:
// A System.CodeDom.CodeExpression に return ステートメントに返す値を示すまたは null ステートメントが、サブルーチンの一部である場合。
public CodeExpression Expression
{
get;
set;
}
}
}