[DataContract]
public class SearchResults
{
[DataMember]
public List<SearchDetail> PList { get; set; }
[DataMemberAttribute]
public int Count { get; set; }
}
The metadata for DataMember
and DataMemberAttribute
are same.
Is 'DataMember' just an alias of the other? Which one should we be using? (If possible please provide a link)
Yes, the 'Attribute' on the attribute name is optional. Use whatever makes you happy.
Attributes on MSDN (See the Note 2/3rd's down)
Note
By convention, all attribute names end with the word "Attribute" to distinguish them from other items in the .NET Framework. However, you do not need to specify the attribute suffix when using attributes in code. For example, [DllImport] is equivalent to [DllImportAttribute], but DllImportAttribute is the attribute's actual name in the .NET Framework.