nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

.NET Framework Class Library  

CodeArgumentReferenceExpression Class

Represents a reference to the value of an argument passed to a method.

For a list of all members of this type, see CodeArgumentReferenceExpression Members.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeExpression
         System.CodeDom.CodeArgumentReferenceExpression

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeArgumentReferenceExpression
   Inherits CodeExpression
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeArgumentReferenceExpression : CodeExpression
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeArgumentReferenceExpression : public
   CodeExpression
[JScript]
public
   Serializable
   ClassInterface(ClassInterfaceType.AutoDispatch)
   ComVisible(true)
class CodeArgumentReferenceExpression extends
   CodeExpression

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Remarks

CodeArgumentReferenceExpression can be used in a method to reference the value of a parameter that has been passed to the method.

The ParameterName property specifies the name of the parameter to reference.

Example

[Visual Basic, C#, C++] The following example code defines a method that invokes Console.WriteLine to output the string parameter passed to the method. A CodeArgumentReferenceExpression references the argument passed to the method by method parameter name.

[Visual Basic] 
' Declare a method that accepts a string parameter named text.
Dim cmm As New CodeMemberMethod()
cmm.Parameters.Add(New CodeParameterDeclarationExpression("String", "text"))
cmm.Name = "WriteString"
cmm.ReturnType = New CodeTypeReference("System.Void")

' Create a method invoke statement to output the string passed to the method.
Dim cmie As New CodeMethodInvokeExpression(New CodeTypeReferenceExpression("Console"), "WriteLine", New CodeArgumentReferenceExpression("text"))

' Add the method invoke expression to the method's statements collection.
cmm.Statements.Add(cmie)
        
' A Visual Basic code generator produces the following source code for the preceeding example code:
'        Private Sub WriteString(ByVal [text] As [String])
'            Console.WriteLine([text])
'        End Sub

[C#] 
// Declare a method that accepts a string parameter named text.
CodeMemberMethod cmm = new CodeMemberMethod();
cmm.Parameters.Add( new CodeParameterDeclarationExpression("String", "text") );
cmm.Name = "WriteString";
cmm.ReturnType = new CodeTypeReference("System.Void");        
        
// Create a method invoke statement to output the string passed to the method.
CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression( new CodeTypeReferenceExpression("Console"), "WriteLine", new CodeArgumentReferenceExpression("text") );

// Add the method invoke expression to the method's statements collection.
cmm.Statements.Add( cmie );
 
// A C# code generator produces the following source code for the preceeding example code:        
//        private void WriteString(String text) 
//        {
//            Console.WriteLine(text);
//        }                         

[C++] 
// Declare a method that accepts a string parameter named text.
CodeMemberMethod* cmm = new CodeMemberMethod();
cmm->Parameters->Add(new CodeParameterDeclarationExpression(S"String", S"text"));
cmm->Name = S"WriteString";
cmm->ReturnType = new CodeTypeReference(S"System::Void");

CodeExpression* ce[] = {new CodeArgumentReferenceExpression(S"test1")}; 

// Create a method invoke statement to output the string passed to the method.
CodeMethodInvokeExpression* cmie = 
    new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(S"Console"), 
    S"WriteLine", ce);

// Add the method invoke expression to the method's statements collection.
cmm->Statements->Add(cmie);

// A C++ code generator produces the following source code for the preceeding example code:
// private:
//     void WriteString(String text) {
//          Console::WriteLine(text);
//    }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodeArgumentReferenceExpression Members | System.CodeDom Namespace