本文整理匯總了C#中System.Resolver.RemoveAt方法的典型用法代碼示例。如果您正苦於以下問題:C# Resolver.RemoveAt方法的具體用法?C# Resolver.RemoveAt怎麽用?C# Resolver.RemoveAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Resolver
的用法示例。
在下文中一共展示了Resolver.RemoveAt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestCache
public void TestCache() {
Resolver<ContentType> resolver = new Resolver<ContentType>();
resolver.Add(new ContentType("*.html", "text/html"));
resolver.Add(new ContentType("*.jpg", "image/jpeg"));
resolver.Add(new ContentType("/images/*", "image/jpeg"));
resolver.Add(new ContentType("/log/**", "text/plain"));
resolver.Add(new ContentType("*.exe", "application/octetstream"));
resolver.Add(new ContentType("**.txt", "text/plain"));
resolver.Add(new ContentType("/html/*", "text/html"));
AssertEquals(7, resolver.Count);
AssertEquals("image/jpeg", resolver.Resolve("image.jpg").Value);
AssertEquals("text/plain", resolver.Resolve("README.txt").Value);
int index = 0;
for(int i = resolver.Count; i > 0; i--) {
ContentType type = resolver[i - 1];
if(type.Value.Equals("text/plain")) {
index = i;
}
}
resolver.RemoveAt(index);
resolver.Add(new ContentType("*", "application/octetstream"));
AssertEquals("application/octetstream", resolver.Resolve("README.txt").Value);
AssertEquals("application/octetstream", resolver.Resolve("README.txt").Value);
resolver.Add(new ContentType("README.*", "text/html"));
resolver.Add(new ContentType("README.txt", "text/plain"));
AssertEquals("text/plain", resolver.Resolve("README.txt").Value);
AssertEquals("text/html", resolver.Resolve("README.jsp").Value);
}