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

后端 未结 8 1702
天涯浪人
天涯浪人 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:35

    As others have written, I don't think this is possible. But what you can do, is to alias the full namespaces instead of each single class you want to use, e.g:

    using rs = ReportService2005;
    using re = ReportExecution;
    
    // ...
    
    rs.ParameterValue[] values = null;
    rs.DataSourceCredentials[] credentials = null;
    rs.ReportParameter[] parameters;
    re.ParameterValue v2 = ...;
    

提交回复
热议问题