TrustLevelCollection クラス
アセンブリ: System.Web (system.web.dll 内)



TrustLevelCollection クラスを使用する方法を次のコード例に示します。
Imports System Imports System.Collections.Generic Imports System.Text Imports System.Configuration Imports System.Web Imports System.Web.Configuration Namespace Samples.Aspnet.SystemWebConfiguration Class UsingTrustLevelCollection Public Shared Sub Main() Try ' Display title. Console.WriteLine("ASP.NET TrustLevelCollection Info") Console.WriteLine() ' Instantiate a new TrustLevelCollection object. Dim TrustLevelCollection1 As TrustLevelCollection = _ New TrustLevelCollection() ' Add a new TrustLevel to the collection. TrustLevelCollection1.Add(New TrustLevel("Level1", "Level1.config")) ' Create a new TrustLevel object. Dim TrustLevel2 As TrustLevel = _ New TrustLevel("myLevel2", "myLevel2.config") ' Set the TrustLevel object within the collection. TrustLevelCollection1.Set(1, TrustLevel2) ' Display item details of the collection. For i As Integer = 0 To (TrustLevelCollection1.Count - 1) Console.WriteLine("Collection item {0}", i) Console.WriteLine("Name: {0}", _ TrustLevelCollection1.Get(i).Name) Console.WriteLine("PolicyFile: {0}", _ TrustLevelCollection1.Get(i).PolicyFile) Console.WriteLine() Next i Catch e As Exception ' Unknown error. Console.WriteLine(e.ToString()) End Try ' Display and wait. Console.ReadLine() End Sub End Class End Namespace
#region Using directives using System; using System.Collections.Generic; using System.Text; using System.Configuration; using System.Web; using System.Web.Configuration; #endregion namespace Samples.Aspnet.SystemWebConfiguration { class UsingTrustLevelCollection { static void Main(string[] args) { try { // Display title. Console.WriteLine("ASP.NET TrustLevelCollection Info"); Console.WriteLine(); // Instantiate a new TrustLevelCollection object. TrustLevelCollection TrustLevelCollection1 = new TrustLevelCollection(); // Add a new TrustLevel to the collection. TrustLevelCollection1.Add(new TrustLevel("Level1", "Level1.config")); // Create a new TrustLevel object. TrustLevel TrustLevel2 = new TrustLevel("Level2", "Level2.config"); // Set the TrustLevel object within the collection. TrustLevelCollection1.Set(1, TrustLevel2); // Display item details of the collection. for (int i = 0; i < TrustLevelCollection1.Count; i++) { Console.WriteLine("Collection item {0}", i); Console.WriteLine("Name: {0}", TrustLevelCollection1.Get(i).Name); Console.WriteLine("PolicyFile: {0}", TrustLevelCollection1.Get(i).PolicyFile); Console.WriteLine(); } } catch (Exception e) { // Unknown error. Console.WriteLine(e.ToString()); } // Display and wait. Console.ReadLine(); } } }

System.Configuration.ConfigurationElement
System.Configuration.ConfigurationElementCollection
System.Web.Configuration.TrustLevelCollection


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- TrustLevelCollection クラスのページへのリンク