TagMapCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
包含对象的集合 TagMapInfo 。
public ref class TagMapCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.TagMapInfo))]
public sealed class TagMapCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.TagMapInfo))>]
type TagMapCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class TagMapCollection
Inherits ConfigurationElementCollection
- 继承
- 属性
示例
以下配置文件摘录显示了如何以声明方式指定类型的多个属性 TagMapCollection 的值。
<system.web>
<pages>
<tagMapping>
<clear />
<add
tagType=
"System.Web.UI.WebControls.WebParts.WebPartManager"
mappedTagType=
"Microsoft.Sharepoint.WebPartPartManager,
MSPS.Web.dll, Version='2.0.0.0'"
/>
<remove tagType="SomeOtherNS.Class, Assemblyname" />
</tagMapping>
</pages>
</system.web>
下面的代码示例演示如何使用 TagMapCollection 类以编程方式修改标记映射设置。 该代码示例是 PagesSection 类中的一个较大示例的一部分。
// Get all current TagMappings in the collection.
for (int i = 0; i < pagesSection.TagMapping.Count; i++)
{
Console.WriteLine("TagMapping {0}:", i);
Console.WriteLine(" TagTypeName = '{0}'",
pagesSection.TagMapping[i].TagType);
Console.WriteLine(" MappedTagTypeName = '{0}'",
pagesSection.TagMapping[i].MappedTagType);
}
// Add a TagMapInfo object using a constructor.
pagesSection.TagMapping.Add(
new System.Web.Configuration.TagMapInfo(
"MyNameSpace.MyControl", "MyNameSpace.MyOtherControl"));
' Get all current TagMappings in the collection.
Dim k As Int32
For k = 1 To pagesSection.TagMapping.Count
Console.WriteLine("TagMapping {0}:", i)
Console.WriteLine(" TagTypeName = '{0}'", _
pagesSection.TagMapping(k).TagType)
Console.WriteLine(" MappedTagTypeName = '{0}'", _
pagesSection.TagMapping(k).MappedTagType)
Next
' Add a TagMapInfo object using a constructor.
pagesSection.TagMapping.Add( _
New System.Web.Configuration.TagMapInfo( _
"MyNameSpace.MyControl", "MyNameSpace.MyOtherControl"))
注解
类 TagMapInfo 允许你在编译时重新映射标记的类型。 此重新映射会导致映射类型代替配置文件范围内 ASP.NET 应用程序中所有页面和控件的原始标记类型。
该 TagMapCollection 类允许以编程方式访问和修改 tagMapping 配置文件节的 pages 子节。 在子节中 tagMapping ,可以通过指定类型的完全限定强名称来添加和删除标记类型之间的映射。
注释
与 pages 节中的其他属性和集合不同,标记重新映射没有匹配 ASP.NET 页指令。
构造函数
| 名称 | 说明 |
|---|---|
| TagMapCollection() |
初始化 TagMapCollection 类的新实例。 |
属性
方法
显式接口实现
| 名称 | 说明 |
|---|---|
| ICollection.CopyTo(Array, Int32) |
将 ConfigurationElementCollection 复制到数组。 (继承自 ConfigurationElementCollection) |
扩展方法
| 名称 | 说明 |
|---|---|
| AsParallel(IEnumerable) |
启用查询的并行化。 |
| AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。 |
| Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定类型。 |
| OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。 |