Private assemblyPath As String
Private className As String

解决方案 »

  1.   

    抱歉,不是这里,写露了,
    string是有的,并且都付过值了。继续……
      

  2.   

    C#: GetConstructor(new Type[0])
    ===>
    VB.NET: GetConstructor(Type.EmptyTypes)
      

  3.   

    Cache cache = System.Web.HttpContext.Current.Cache; //缓存
    string assemblyPath;  //dll文件物理路径
    string className;     //要加载的类名字cache.Insert( "IDataProviderBase", Assembly.LoadFrom( assemblyPath).GetType( className ).GetConstructor(new Type[0]), new CacheDependency( assemblyPath ) );
    ----------------------------------------
    dim cache as new Cache()
    cache System.Web.HttpContext.Current.Cachedim assemblyPath as string
    dim className as stringcache.Insert( "IDataProviderBase", Assembly.LoadFrom( assemblyPath).GetType( className ).GetConstructor(new Type[0]), new CacheDependency( assemblyPath ) )
      

  4.   

    saucer , 还是不行。还是在 GetConstructor 的地方提示:“需要表达式”冬天:看不懂你写的,你干吗把我的抄了一遍又写了下来呢?
      

  5.   

    dim _cache As System.Web.Caching.Cache = _
        System.Web.HttpContext.Current.Cache           
    dim assemblyPath as string                          
    dim className as string                    _cache.Insert( "IDataProviderBase", _
        System.Reflection.Assembly.LoadFrom(assemblyPath).GetType(className).GetConstructor(Type.EmptyTypes), _
        New CacheDependency( assemblyPath ))
      

  6.   

    saucer, 搞定,谢了!
    能不能稍稍解释一下,为什么 C# 里面直接写就可以, VB.net 就必须写上 System.Reflection... 才行呢?还有像上面的 Cache, C# 里面可以直接写 Cache cache;
    VB.net 里面就必须写:Dim _cache As System.Web.Caching.Cache大致点拨一下就可以了,谢谢!
      

  7.   

    you need to 
    Imports System.Reflection
    Imports System.Web.Caching"Assembly" is a little weird, frankly, I don't know the reason, not sure if "Assembly" is a keyword
      

  8.   

    如果这么写:Imports System.Reflection
    Imports System.Web.CachingDim _cache As Cache
    .......错误是:error BC30561: “Cache”不明确,从命名空间或类型“System.Reflection, System.Web.Caching”导入。“文档”中对此错误的描述为:“<name1>”不明确,从命名空间或类型“<name2>”导入提供的名称不明确,从而与另一个名称冲突。Visual Basic 编译器没有任何冲突解决规则,您必须自己消除名称的歧义。纠正此错误:* 移除命名空间导入,消除名称歧义。 
    * 完全限定名称。 
    ================================Assembly 那个提示就是:需要表达式。“文档”里面对这个错误的解释是:运算符(例如 + 或 =)要求一个表达式作为其右操作数,但在其右侧没有找到可识别的表达式。纠正此错误:* 提供一个有效的表达式作为运算符的右操作数。 
      

  9.   

    Assembly 那个,如果单独写,错误波浪线 ~~~~ 就标在 Assembly 下面,
    像上面那样的写在参数里面的,错误就标在 GetConstructor 下面。
      

  10.   

    System.Reflection does not have a class named Cache, something is funny with the VBC compiler
      

  11.   

    思归是微软公司的吗?为什么个人介绍上面写了个 ASP.NET Starter Kits ?下载下来看看,只有 Lunar.net (就是那个 Community 的)一次安装成功,另外两个(Report, Time Tracker)都不能自己安装 SQL。sigh ~~~上次改 ASPNETForums 的那个 SQL 排序标准不兼容的 bug 就很费劲,有空再研究这个吧!
      

  12.   

    I do not work for Microsoft, I was recommending ASP.NET Starter Kits to anyone itnerested