DnsPermission.Copy メソッド
アセンブリ: System (system.dll 内)

Dim instance As DnsPermission Dim returnValue As IPermission returnValue = instance.Copy
現在のインスタンスのコピーである DnsPermission クラスの新しいインスタンス。


既存の DnsPermission インスタンスのコピーを作成する例を次に示します。
Public Sub UseDns() ' Create a DnsPermission instance. Dim myPermission As New DnsPermission(PermissionState.Unrestricted) ' Check for permission. myPermission.Demand() ' Create an identical copy of the above DnsPermission object. Dim myPermissionCopy As DnsPermission = CType(myPermission.Copy(), DnsPermission) Console.WriteLine("Attributes and Values of 'DnsPermission' instance :") ' Print the attributes and values. PrintKeysAndValues(myPermission.ToXml().Attributes) Console.WriteLine("Attribute and values of copied instance :") PrintKeysAndValues(myPermissionCopy.ToXml().Attributes) End Sub 'UseDns Private Sub PrintKeysAndValues(myHashtable As Hashtable) ' Get the enumerator that can iterate through he hash table. Dim myEnumerator As IDictionaryEnumerator = myHashtable.GetEnumerator() Console.WriteLine(ControlChars.Tab + "-KEY-" + ControlChars.Tab + "-VALUE-") While myEnumerator.MoveNext() Console.WriteLine(ControlChars.Tab + "{0}:" + ControlChars.Tab + "{1}", myEnumerator.Key, myEnumerator.Value) End While Console.WriteLine() End Sub 'PrintKeysAndValues
public void UseDns() { // Create a DnsPermission instance. DnsPermission myPermission = new DnsPermission(PermissionState.Unrestricted); // Check for permission. myPermission.Demand(); // Create an identical copy of the above 'DnsPermission' object. DnsPermission myPermissionCopy = (DnsPermission)myPermission.Copy(); Console.WriteLine("Attributes and Values of 'DnsPermission' instance :"); // Print the attributes and values. PrintKeysAndValues(myPermission.ToXml().Attributes); Console.WriteLine("Attribute and values of copied instance :"); PrintKeysAndValues(myPermissionCopy.ToXml().Attributes); } private void PrintKeysAndValues(Hashtable myHashtable) { // Get the enumerator that can iterate through the hash table. IDictionaryEnumerator myEnumerator = myHashtable.GetEnumerator(); Console.WriteLine("\t-KEY-\t-VALUE-"); while (myEnumerator.MoveNext()) Console.WriteLine("\t{0}:\t{1}", myEnumerator.Key, myEnumerator.Value); Console.WriteLine(); }
public: void UseDns() { // Create a DnsPermission instance. DnsPermission^ myPermission = gcnew DnsPermission( PermissionState::Unrestricted ); // Check for permission. myPermission->Demand(); // Create an identical copy of the above 'DnsPermission' Object*. DnsPermission^ myPermissionCopy = dynamic_cast<DnsPermission^>(myPermission->Copy()); Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); // Print the attributes and values. PrintKeysAndValues( myPermission->ToXml()->Attributes ); Console::WriteLine( "Attribute and values of copied instance :" ); PrintKeysAndValues( myPermissionCopy->ToXml()->Attributes ); } private: void PrintKeysAndValues( Hashtable^ myHashtable ) { // Get the enumerator that can iterate through the hash table. IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); Console::WriteLine( "\t-KEY-\t-VALUE-" ); while ( myEnumerator->MoveNext() ) { Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); } Console::WriteLine(); }
public void UseDns() { // Create a DnsPermission instance. DnsPermission myPermission = new DnsPermission(PermissionState. Unrestricted); // Check for permission. myPermission.Demand(); // Create an identical copy of the above 'DnsPermission' object. DnsPermission myPermissionCopy = (DnsPermission)myPermission.Copy(); Console.WriteLine("Attributes and Values of 'DnsPermission' " + "instance :"); // Print the attributes and values. PrintKeysAndValues(myPermission.ToXml().get_Attributes()); Console.WriteLine("Attribute and values of copied instance :"); PrintKeysAndValues(myPermissionCopy.ToXml().get_Attributes()); } //UseDns private void PrintKeysAndValues(Hashtable myHashtable) { // Get the enumerator that can iterate through the hash table. IDictionaryEnumerator myEnumerator = myHashtable.GetEnumerator(); Console.WriteLine("\t-KEY-\t-VALUE-"); while (myEnumerator.MoveNext()) { Console.WriteLine("\t{0}:\t{1}", myEnumerator.get_Key(), myEnumerator.get_Value()); } Console.WriteLine(); } //PrintKeysAndValues

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


Weblioに収録されているすべての辞書からDnsPermission.Copy メソッドを検索する場合は、下記のリンクをクリックしてください。

- DnsPermission.Copy メソッドのページへのリンク