Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在ASP.NET中解析模糊名称_C#_Asp.net_.net - Fatal编程技术网

C# 在ASP.NET中解析模糊名称

C# 在ASP.NET中解析模糊名称,c#,asp.net,.net,C#,Asp.net,.net,键入类的全名(如 myNamespace.y.calendar cal=new myNamespace.y.calendar() (因为asp.net在System.web.ui.WebControl中已经有一个名为calendar的类名)。 所以为了解决这个问题,我们可以使用 using Calendar = myNamespace.y.calendar; Calendar cal = new Calendar(); 但是如何在asp.net aspx页面中执行相同的操作? <%@ I

键入类的全名(如
myNamespace.y.calendar cal=new myNamespace.y.calendar()
(因为asp.net在System.web.ui.WebControl中已经有一个名为calendar的类名)。
所以为了解决这个问题,我们可以使用

using Calendar = myNamespace.y.calendar;
Calendar cal = new Calendar();
但是如何在asp.net aspx页面中执行相同的操作?


<%@ Import Namespace="Calendar=myNamespace.y.calendar" %>
有关的更多信息。如果您的类名与来自不同命名空间的另一个类不明确,仅导入命名空间可能是不够的:

using colAlias = System.Collections;
namespace System
{
    class TestClass
    {
        static void Main()
        {
            // Searching the alias:
            colAlias::Hashtable test = new colAlias::Hashtable();

            // Add items to the table.
            test.Add("A", "1");
            test.Add("B", "2");
            test.Add("C", "3");

            foreach (string name in test.Keys)
            {
                // Seaching the gloabal namespace:
                global::System.Console.WriteLine(name + " " + test[name]);
            }
        }
    }
}