什麼是選擇序列器

/// <summary>
/// Defines a student.
/// </summary>
[DataContract]
public class Student
{
    /// <summary>
    /// Gets or sets the student number.
    /// </summary>
    [DataMember]
    public string StudentNumber { get; set; }

    /// <summary>
    /// Gets or sets the first name.
    /// </summary>
    [DataMember]
    public string FirstName { get; set; }

    /// <summary>
    /// Gets or sets the last name.
    /// </summary>
    [DataMember]
    public string LastName { get; set; }

    /// <summary>
    /// Gets or sets the marks obtained.
    /// </summary>
    public int MarksObtained { get; set; }
}

/// <summary>
/// A service that provides the operations for students.
/// </summary>
[ServiceContract]
public interface IStudentService
{
    //Service contract code here.
}

在上面的程式碼 StudentNumber 中,Student 類的 FirstNameLastName 屬性用 DataMember 屬性明確標記為 MarksObtained,因此 MarksObtained 將被忽略。從忽略意味著它意味著 MarksObtained 不會成為通過電纜進出該服務的資料的一部分。