CodeDom, properties assigning

  • Thread starter Thread starter Vladimir S.
  • Start date Start date
V

Vladimir S.

hi all
, i am using CodeDom, and trying to generate code that assigns one property
to another.
code looks like

CodePropertyReferenceExpression propertyRef1 =
new CodePropertyReferenceExpression(new CodeThisReferenceExpression(),
"TestProperty");

CodePropertyReferenceExpression propertyRef2 =
new CodePropertyReferenceExpression(someTypeRef, "TestProperty2");

CodeAssignStatement as1 = new CodeAssignStatement(propertyRef1 ,
propertyRef2 );

it produces something like

this.TestProperty = someTypeRef.TestProperty2;
someTypeRef = new someTypeRef(); //!!!!

the truble is that i need the assigning line appear after the initialization
of a type "someTypeRef" ...
so, the question is how to do that, and is there another way of properties
assigning ?
i found no relative topics in msdn, there is only examples of generating
code where the methods are using...

p.s. the use of LinePragma property of class CodeAssignStatement is not
suitable for me, cause I don't know the file's name, and where to place the
generating code...

thanks
 
Back
Top