Op Englesch liesen Editéieren

Deelen iwwer


DnsPermission.IsUnrestricted Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Checks the overall permission state of the object.

C#
public bool IsUnrestricted();

Returns

true if the DnsPermission instance was created with Unrestricted; otherwise, false.

Implements

Examples

The following example uses the IsUnrestricted method to check the overall permission state of the object.

C#
public void useDns() {
   // Create a DnsPermission instance.
   DnsPermission permission = new DnsPermission(PermissionState.Unrestricted);
   // Check for permission.
   permission.Demand();
   Console.WriteLine("Attributes and Values of DnsPermission instance :");
   // Print the attributes and values.
   PrintKeysAndValues(permission.ToXml().Attributes);
   // Check the permission state.
   if (permission.IsUnrestricted())
      Console.WriteLine("Overall permissions : Unrestricted");
   else
      Console.WriteLine("Overall permissions : Restricted");
}

private void PrintKeysAndValues(Hashtable myList) {
   // Get the enumerator that can iterate through the hash table.
   IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
   Console.WriteLine("\t-KEY-\t-VALUE-");
   while (myEnumerator.MoveNext())
      Console.WriteLine("\t{0}:\t{1}", myEnumerator.Key, myEnumerator.Value);
   Console.WriteLine();
}

Applies to

Produkt Versiounen
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10