Posts
391
Comments
137
Trackbacks
0
Constructor via Reflection kopieren

Kann man vielleicht mal wieder brauchen: Constructor via Reflection kopieren

//copy constructor

public ClassName(Testclass testclass)

{

FieldInfo[] lFields = this.GetType().GetFields(BindingFlags.NonPublic

            | BindingFlags.Public | BindingFlags.Instance);

 

foreach (FieldInfo fi in lFields)

            fi.SetValue(this, fi.GetValue(testclass));

}

posted on Wednesday, June 23, 2010 6:53 AM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 8 and 3 and type the answer here: