C#ASP.NET相当于Classic ASP Server.CreateObject()。存在()

时间:2016-10-26 10:23:05

标签: c# asp.net vbscript asp-classic

我的任务是将经典ASP应用程序转换为ASP.NET MVC5应用程序,但是我很难找到与C#ASP.NET相同的Server.CreateObject().Exists()

经典ASP:

Set courseDirectory = Server.CreateObject("Scripting.Dictionary")

If Not (courseDirectory.Exists(clashKey)) AND Not (courseDirectory.Exists(altClashKey)) Then
    '...
End If
到目前为止

等效的C#:

object courseDirectory = new object();

courseDirectory = HttpContext.Current.Server.CreateObject("Scripting.Dictionary");

//problem here
if (!(courseDirectory.Exists())...

为了在C#ASP.NET中实现同样的目的,我该怎么做?

1 个答案:

答案 0 :(得分:0)

这不仅仅是一本普通的字典吗?怎么样:

var courseDirectory = new Dictionary<string, object>()