Override Default Constructor of Partial Class with Another Partial Class

前端 未结 12 1871
时光取名叫无心
时光取名叫无心 2020-12-28 12:59

I don\'t think this is possible, but if is then I need it :)

I have a auto-generated proxy file from the wsdl.exe command line tool by Visual Studio 2008.

Th

12条回答
  •  一个人的身影
    2020-12-28 13:33

    Nothing that I can think of. The "best" way I can come up with is to add a ctor with a dummy parameter and use that:

    public partial class MyWebService : System.Web.Services.Protocols.SoapHttpClientProtocol 
    {
       public override MyWebService(int dummy) 
       { 
             string myString = "overridden constructor";
             //other code...
       }
    }
    
    
    MyWebService mws = new MyWebService(0);
    

提交回复
热议问题