How Can I Get C# To Distinguish Between Ambiguous Class Names?

后端 未结 3 671
遥遥无期
遥遥无期 2021-02-07 08:21

How can I get C# to distinguish between ambiguous class types without having to specify the full HtmlAgilityPack.HtmlDocument name every time (it is ambiguous compa

3条回答
  •  生来不讨喜
    2021-02-07 08:57

    Declare conflicting namespaces at different levels, most inner one will be used without ambiguity:

    using System.Windows.Forms;
    
    namespace MyNamespace {
        using HtmlAgilityPack;
    
        public class Class1 {
            private HtmlDocument _doc; // HtmlAgilityPack.HtmlDocument
        }
    

提交回复
热议问题