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
Use aliases:
using HapHtmlDocument = HtmlAgilityPack.HtmlDocument;
using WfHtmlDocument = System.Windows.Forms.HtmlDocument;
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
}
You can define an alias for one namespace, e.g:
using hap = HtmlAgilityPack;
and then use the alias instead of the full namespace:
hap.HtmlDocument doc = new hap.HtmlDocument;