Export (0) Print
Expand All

ChoiceAttribute class

Maps a member of an enumeration to a String choice value for a Choice or MultiChoice type field on a Microsoft SharePoint Foundation list.

System.Object
  System.Attribute
    Microsoft.SharePoint.Linq.DataAttribute
      Microsoft.SharePoint.Linq.ChoiceAttribute

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

[AttributeUsageAttribute(AttributeTargets.Field, AllowMultiple = false)]
public sealed class ChoiceAttribute : DataAttribute

This attribute is used to decorate the members of an enum class.

The inherited members of this class are not applicable and should be ignored.

The following is an example of this attribute in use:


public enum TaskStatusChoices : int {

Invalid,

None,

[Choice(Value="Not Started")]
NotStarted,

[Choice(Value="In Progress")]
InProgress,

[Choice(Value="Completed")]
Completed,

[Choice(Value="Deferred")]
Deferred,

[Choice(Value="Waiting on someone else")]
WaitingOnSomeoneElse,
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft