CodeMethodReturnStatement クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CodeMethodReturnStatement クラスの意味・解説 

CodeMethodReturnStatement クラス

値を返す return ステートメント表します

名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文構文

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeMethodReturnStatement
    Inherits CodeStatement
Dim instance As CodeMethodReturnStatement
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeMethodReturnStatement : CodeStatement
[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] 
[ComVisibleAttribute(true)] 
public ref class CodeMethodReturnStatement
 : public CodeStatement
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeMethodReturnStatement extends
 CodeStatement
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeMethodReturnStatement extends
 CodeStatement
解説解説

CodeMethodReturnStatement使用して、値を返す return ステートメントを表すことができますExpression プロパティは、返す値を指定します

使用例使用例

CodeMethodReturnStatement使用してメソッドから値を返す例を次に示します

' Defines a method that returns a string passed to it.
Dim method1 As 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 Visual Basic code generator produces the following source code for
 the preceeding example code:

'   Private Function ReturnString(ByVal [text] As String) As String
'       Return [Text]
'   End Function
// 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:

//    private string ReturnString(string text) 
//    {
//        return text;
//    }
// Defines a method that returns a string passed to it.
CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
method1->Name = "ReturnString";
method1->ReturnType = gcnew CodeTypeReference( "System.String" );
method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","text"
 ) );
method1->Statements->Add( gcnew CodeMethodReturnStatement( gcnew CodeArgumentReferenceExpression(
 "text" ) ) );

// A C# code generator produces the following source code for the preceeding
 example code:
//    private string ReturnString(string text) 
//    {
//        return text;
//    }
// Defines a method that returns a string passed to it.
CodeMemberMethod method1 = new CodeMemberMethod();
method1.set_Name("ReturnString");
method1.set_ReturnType(new CodeTypeReference("System.String"));
method1.get_Parameters().Add(new CodeParameterDeclarationExpression(
    "System.String", "text"));
method1.get_Statements().Add(new CodeMethodReturnStatement(new
 
    CodeArgumentReferenceExpression("text")));
// A VJ# code generator produces the following source code for 
// the preceeding example code:
//    private String ReturnString(String text) 
//    {
//        return text;
//    } //ReturnString
継承階層継承階層
System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeStatement
      System.CodeDom.CodeMethodReturnStatement
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「CodeMethodReturnStatement クラス」の関連用語

CodeMethodReturnStatement クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



CodeMethodReturnStatement クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS