Ambiguous Reference error between two namespaces

前端 未结 3 1448
慢半拍i
慢半拍i 2021-01-15 15:38

I get this message while trying to run a webservice on the browser. Note that the source code is a windows file and can\'t be changed for my need.

Com

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-15 16:15

    You need to adjust the signature to specify the explicit namespace of the Message class:

    void WriteSoapMessage(MessageBinding messageBinding, 
        ThreeDSeekUtils.Message message, bool soap12)
    

    or

    void WriteSoapMessage(MessageBinding messageBinding, 
        System.Web.Services.Description.Message message, bool soap12)
    

    Whichever is appropriate. Another option is to alias your namespaces in the using block at the top of the class:

    using ThreeD = ThreeDSeekUtils;
    using ServicesDesc = System.Web.Services.Description;
    

    Then you could use the aliases in shorter form:

    void WriteSoapMessage(MessageBinding messageBinding, 
        ThreeD.Message message, bool soap12)
    

    or

    void WriteSoapMessage(MessageBinding messageBinding, 
        ServicesDesc.Message message, bool soap12)
    

提交回复
热议问题