c# - What to pass as string argument to constructor? -


i have following situation:

protected mobilewalletrequestbase(xmldocument xmldoc, string request) {     _xmldoc = xmldoc; }  protected mobilewalletrequestbase()     : this(new xmldocument(), ?) {     _xmldoc.loadxml("<?xml version=\"1.0\" encoding=\"utf-8\"?><request/>"); } 

what should write in second constructor in order pass string value?

one approach use default argument:

protected mobilewalletrequestbase(xmldocument xmldoc, string request="foo") {     // you're not using request in here, unclear what's needed     _xmldoc = xmldoc;   }  protected mobilewalletrequestbase()     : this(new xmldocument())   // don't {     _xmldoc.loadxml("<?xml version=\"1.0\" encoding=\"utf-8\"?><request/>"); } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -