本文整理汇总了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) {
//.........这里部分代码省略.........
示例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();
//.........这里部分代码省略.........