C#: Use a namespace for a specific block of code?

后端 未结 8 1523
天涯浪人
天涯浪人 2021-01-17 12:21

I just have a point of curiosity. I\'m working with SSRS and calling its SOAP methods. I\'ve got stubs generated / Web references created and that\'s all working fine and I

8条回答
  •  北海茫月
    2021-01-17 12:39

    What you can do, is mark your class as partial:

    public partial class MyWebServiceClass
    

    in your main source file, and create a second source file with the method where you want to use the other namespace

    // MyWebServiceClass.usingMethods.cs
    
    using ReportService2005;
    public partial class MyWebServiceClass
    {
        // methods...
    }
    

提交回复
热议问题