Custom CodeDomSerializer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EvilProject
    New Member
    • Nov 2007
    • 16

    Custom CodeDomSerializer

    Hi, I'm writing a custom codedomserializ er for a control(using DesignerSeriali zer).
    It works great but i can only insert statements to the initializecompe net method.
    I want to create a methods in the container of the control outside the initalizecompon ent method. how can this be done?
  • EvilProject
    New Member
    • Nov 2007
    • 16

    #2
    ok i finnaly managed to do this.
    usign the IDesignerSerial izationManager. GetService Method

    Code:
                    CodeMemberMethod Method = new CodeMemberMethod();
                    Method.Name = ((MultisetContainer)value).Name + "_ChangeSet_Test";                
                    Method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "sender"));
                    Method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(EventArgs), "e"));
                    Method.ReturnType = new CodeTypeReference(typeof(void));
                    CodeTypeDeclaration typedecl = (CodeTypeDeclaration)manager.GetService(typeof(CodeTypeDeclaration ));
                    typedecl.Members.Add(Method);

    Comment

    Working...