当前位置: 首页>>代码示例>>C#>>正文


C# CacheDependency.GetType方法代码示例

本文整理汇总了C#中System.Web.Caching.CacheDependency.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CacheDependency.GetType方法的具体用法?C# CacheDependency.GetType怎么用?C# CacheDependency.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Caching.CacheDependency的用法示例。


在下文中一共展示了CacheDependency.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        void Init(bool isPublic, string[] filenamesArg, string[] cachekeysArg, CacheDependency dependency, DateTime utcStart) {
#if USE_MEMORY_CACHE
            if (CacheInternal.UseMemoryCache) {
                InitForMemoryCache(isPublic, filenamesArg, cachekeysArg, dependency, utcStart);
                return;
            }
#endif
            DepFileInfo[]   depFileInfos = s_depFileInfosEmpty;
            CacheEntry[]    depEntries = s_entriesEmpty;
            string []       filenames, cachekeys;
            CacheInternal   cacheInternal;

            _bits = new SafeBitVector32(0);

            // copy array argument contents so they can't be changed beneath us
            if (filenamesArg != null) {
                filenames = (string []) filenamesArg.Clone();
            }
            else {
                filenames = null;
            }

            if (cachekeysArg != null) {
                cachekeys = (string []) cachekeysArg.Clone();
            }
            else {
                cachekeys = null;
            }

            _utcLastModified = DateTime.MinValue;

            try {
                // validate filenames array
                if (filenames == null) {
                    filenames = s_stringsEmpty;
                }
                else {
                    foreach (string f in filenames) {
                        if (f == null) {
                            throw new ArgumentNullException("filenamesArg");
                        }

                        // demand PathDiscovery if public
                        if (isPublic) {
                            InternalSecurityPermissions.PathDiscovery(f).Demand();
                        }
                    }
                }

                if (cachekeys == null) {
                    cachekeys = s_stringsEmpty;
                }
                else {
                    // validate cachekeys array
                    foreach (string k in cachekeys) {
                        if (k == null) {
                            throw new ArgumentNullException("cachekeysArg");
                        }
                    }
                }

                // copy all parts of another dependency if provided
                if (dependency == null) {
                    dependency = s_dependencyEmpty;
                }
                else {
                    if (dependency.GetType() != s_dependencyEmpty.GetType()) {
                        throw new ArgumentException(SR.GetString(SR.Invalid_Dependency_Type));
                    }

                    // Copy the parts of the dependency we need before
                    // we reference them, as the dependency can change
                    // underneath us.
                    object d_depFileInfos = dependency._depFileInfos;
                    object d_entries = dependency._entries;
                    DateTime d_lastModified = dependency._utcLastModified;

                    // if the dependency we're copying has changed, we're done
                    if (dependency._bits[CHANGED]) {
                        _bits[CHANGED] = true;
                        // There is nothing to dispose because we haven't started
                        // monitoring anything yet.  But we call DisposeInternal in
                        // order to set the WANTS_DISPOSE bit.
                        DisposeInternal();
                        return;
                    }

                    // copy depFileInfos
                    if (d_depFileInfos != null) {
                        if (d_depFileInfos is DepFileInfo) {
                            depFileInfos = new DepFileInfo[1] {(DepFileInfo) d_depFileInfos};
                        }
                        else {
                            depFileInfos = (DepFileInfo[]) (d_depFileInfos);

                        }

                        // verify that the object was fully constructed
                        // and that we have permission to discover the file
                        foreach (DepFileInfo depFileInfo in depFileInfos) {
//.........这里部分代码省略.........
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:101,代码来源:CacheDependency.cs

示例2: Init

 private void Init(bool isPublic, string[] filenamesArg, string[] cachekeysArg, CacheDependency dependency, DateTime utcStart)
 {
     string[] strArray;
     string[] strArray2;
     DepFileInfo[] infoArray = s_depFileInfosEmpty;
     CacheEntry[] entryArray = s_entriesEmpty;
     this._bits = new SafeBitVector32(0);
     if (filenamesArg != null)
     {
         strArray = (string[]) filenamesArg.Clone();
     }
     else
     {
         strArray = null;
     }
     if (cachekeysArg != null)
     {
         strArray2 = (string[]) cachekeysArg.Clone();
     }
     else
     {
         strArray2 = null;
     }
     this._utcLastModified = DateTime.MinValue;
     try
     {
         if (strArray == null)
         {
             strArray = s_stringsEmpty;
         }
         else
         {
             foreach (string str in strArray)
             {
                 if (str == null)
                 {
                     throw new ArgumentNullException("filenamesArg");
                 }
                 if (isPublic)
                 {
                     InternalSecurityPermissions.PathDiscovery(str).Demand();
                 }
             }
         }
         if (strArray2 == null)
         {
             strArray2 = s_stringsEmpty;
         }
         else
         {
             string[] strArray4 = strArray2;
             for (int i = 0; i < strArray4.Length; i++)
             {
                 if (strArray4[i] == null)
                 {
                     throw new ArgumentNullException("cachekeysArg");
                 }
             }
         }
         if (dependency == null)
         {
             dependency = s_dependencyEmpty;
         }
         else
         {
             if (dependency.GetType() != s_dependencyEmpty.GetType())
             {
                 throw new ArgumentException(System.Web.SR.GetString("Invalid_Dependency_Type"));
             }
             object obj2 = dependency._depFileInfos;
             object obj3 = dependency._entries;
             DateTime time = dependency._utcLastModified;
             if (dependency._bits[4])
             {
                 this._bits[4] = true;
                 this.DisposeInternal();
                 return;
             }
             if (obj2 != null)
             {
                 if (obj2 is DepFileInfo)
                 {
                     infoArray = new DepFileInfo[] { (DepFileInfo) obj2 };
                 }
                 else
                 {
                     infoArray = (DepFileInfo[]) obj2;
                 }
                 foreach (DepFileInfo info in infoArray)
                 {
                     string path = info._filename;
                     if (path == null)
                     {
                         this._bits[4] = true;
                         this.DisposeInternal();
                         return;
                     }
                     if (isPublic)
                     {
                         InternalSecurityPermissions.PathDiscovery(path).Demand();
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:CacheDependency.cs


注:本文中的System.Web.Caching.CacheDependency.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。