Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IsOptional Property
Collapse the table of content
Expand the table of content

ClaimTypeRequirement.IsOptional Property

Gets a value that indicates whether the claim is optional.

Namespace:  System.ServiceModel.Security.Tokens
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public bool IsOptional { get; }

Property Value

Type: System.Boolean
true if this instance of the class is for an optional claim; false if it specifies a required claim.

An example of how to use this property is the scenario in which the service asks for some information but does not require it. For instance, you are required to enter your first name, last name, and address, but your phone number is optional.

The following code shows how to get this property.

WSFederationHttpBinding binding = new WSFederationHttpBinding();
   (new ClaimTypeRequirement
   (new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/UserName", true));
ClaimTypeRequirement cr = new ClaimTypeRequirement
   ("http://schemas.microsoft.com/ws/2005/05/identity/claims/UserName", true);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft