TagPrefixCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
개체 컬렉션을 TagPrefixInfo 포함합니다.
public ref class TagPrefixCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.TagPrefixInfo), AddItemName="add", CollectionType=System.Configuration.ConfigurationElementCollectionType.BasicMap)]
public sealed class TagPrefixCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.TagPrefixInfo), AddItemName="add", CollectionType=System.Configuration.ConfigurationElementCollectionType.BasicMap)>]
type TagPrefixCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class TagPrefixCollection
Inherits ConfigurationElementCollection
- 상속
- 특성
예제
다음 구성 파일 발췌에서는 형식의 여러 속성에 대한 값을 선언적으로 지정하는 TagPrefixCollection 방법을 보여줍니다.
<system.web>
<pages>
<controls>
<clear />
<remove tagPrefix="MyTags" />
<!-- Searches all linked assemblies for the namespace -->
<add tagPrefix="MyTags1" namespace=" MyNameSpace "/>
<!-- Uses a specified assembly -->
<add tagPrefix="MyTags2" namespace="MyNameSpace"
assembly="MyAssembly"/>
<!-- Uses the specified source for the user control -->
<add tagprefix="MyTags3" tagname="MyCtrl" src="MyControl.ascx"/>
</controls>
</pages>
</system.web>
다음 코드 예제에서는 프로그래밍 방식으로 태그 접두사 설정을 수정 하는 클래스를 사용 TagPrefixCollection 하는 방법을 보여 줍니다. 이 코드 예제는 클래스에 제공된 더 큰 예제의 PagesSection 일부입니다.
// Get all current Controls in the collection.
for (int i = 0; i < pagesSection.Controls.Count; i++)
{
Console.WriteLine("Control {0}:", i);
Console.WriteLine(" TagPrefix = '{0}' ",
pagesSection.Controls[i].TagPrefix);
Console.WriteLine(" TagName = '{0}' ",
pagesSection.Controls[i].TagName);
Console.WriteLine(" Source = '{0}' ",
pagesSection.Controls[i].Source);
Console.WriteLine(" Namespace = '{0}' ",
pagesSection.Controls[i].Namespace);
Console.WriteLine(" Assembly = '{0}' ",
pagesSection.Controls[i].Assembly);
}
// Create a new TagPrefixInfo object.
System.Web.Configuration.TagPrefixInfo tagPrefixInfo =
new System.Web.Configuration.TagPrefixInfo("MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", "MyControl.ascx");
// Execute the Add Method.
pagesSection.Controls.Add(tagPrefixInfo);
// Add a TagPrefixInfo object using a constructor.
pagesSection.Controls.Add(
new System.Web.Configuration.TagPrefixInfo(
"MyCtrl", "MyNameSpace", "MyAssembly", "MyControl",
"MyControl.ascx"));
' Get all current Controls in the collection.
Dim j As Int32
For j = 0 To pagesSection.Controls.Count - 1
Console.WriteLine("Control {0}:", j)
Console.WriteLine(" TagPrefix = '{0}' ", _
pagesSection.Controls(j).TagPrefix)
Console.WriteLine(" TagName = '{0}' ", _
pagesSection.Controls(j).TagName)
Console.WriteLine(" Source = '{0}' ", _
pagesSection.Controls(j).Source)
Console.WriteLine(" Namespace = '{0}' ", _
pagesSection.Controls(j).Namespace)
Console.WriteLine(" Assembly = '{0}' ", _
pagesSection.Controls(j).Assembly)
Next
' Create a new TagPrefixInfo object.
Dim tagPrefixInfo As System.Web.Configuration.TagPrefixInfo = _
New System.Web.Configuration.TagPrefixInfo("MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", "MyControl.ascx")
' Execute the Add Method.
pagesSection.Controls.Add(tagPrefixInfo)
' Add a TagPrefixInfo object using a constructor.
pagesSection.Controls.Add( _
New System.Web.Configuration.TagPrefixInfo( _
"MyCtrl", "MyNameSpace", "MyAssembly", "MyControl", _
"MyControl.ascx"))
설명
이 TagPrefixInfo 클래스를 사용하면 구성 파일에 저장된 태그 접두사 정보에 프로그래밍 방식으로 액세스하고 수정할 수 있습니다. 태그 접두사는 사용자 지정 컨트롤 및 사용자 정의 컨트롤이 제대로 작동하려면 포함해야 하는 어셈블리 및 네임스페이스와 ASP.NET "네임스페이스"를 연결합니다.
TagPrefixInfo 개체는 개체의 TagPrefixCollection 멤버로 저장됩니다. 이 TagPrefixCollection 클래스를 사용하면 구성 파일 섹션의 하위 섹션에 controls 프로그래밍 방식으로 액세스하고 수정할 pages 수 있습니다.
생성자
| Name | Description |
|---|---|
| TagPrefixCollection() |
클래스의 새 인스턴스를 TagPrefixCollection 만듭니다. |
속성
메서드
명시적 인터페이스 구현
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
배열에 ConfigurationElementCollection 복사합니다. (다음에서 상속됨 ConfigurationElementCollection) |
확장명 메서드
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
쿼리의 병렬 처리를 사용하도록 설정합니다. |
| AsQueryable(IEnumerable) |
IEnumerable IQueryable변환합니다. |
| Cast<TResult>(IEnumerable) |
IEnumerable 요소를 지정된 형식으로 캐스팅합니다. |
| OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable 요소를 필터링합니다. |