CodeMethodReturnStatement クラス
アセンブリ: System (system.dll 内)
 構文
構文<SerializableAttribute> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class CodeMethodReturnStatement Inherits CodeStatement
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class CodeMethodReturnStatement : CodeStatement
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class CodeMethodReturnStatement : public CodeStatement
 解説
解説 使用例
使用例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.CodeDom.CodeObject
System.CodeDom.CodeStatement
System.CodeDom.CodeMethodReturnStatement
 スレッド セーフ
スレッド セーフ プラットフォーム
プラットフォーム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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
 バージョン情報
バージョン情報 参照
参照- CodeMethodReturnStatement クラスのページへのリンク

 
                             
                    


