什么是选择串行器
/// <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
类的 FirstName
,LastName
属性用 DataMember
属性明确标记为 MarksObtained
,因此 MarksObtained
将被忽略。从忽略意味着它意味着 MarksObtained
不会成为通过电缆进出该服务的数据的一部分。