0

Example:

String name = "setMethodName";

class Test  
{    
    public void setName.[name] (Object o)  
    { 
    }  
}

public static void Main()
{
    Test test = new Test();
    test.setMethodName(new Object());
}
Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
Euler
  • 312
  • 1
  • 11
  • 1
    possible duplicate of [How to create a method at runtime using Reflection.emit](http://stackoverflow.com/questions/3551452/how-to-create-a-method-at-runtime-using-reflection-emit) – Saro Taşciyan Feb 10 '14 at 00:38
  • Looks like a code smell to me. Can you add more information about what are you trying to achieve with this? – Federico Berasategui Feb 10 '14 at 00:42
  • I have extended a DataTable object which connects to delimited file types and that auto-fills the respective column names and data values. Everything works fine... but I want my column names to appear in Intelli-sense, instead of having to use the Field property when using projections in LINQ expressions. The column names will always be available in the files, so they can logically be captured as strings. I have look at the DynamicMethod class already, it is a runtime solution not a compile time solution... – Euler Feb 10 '14 at 02:03

0 Answers0