I simply want to generate an example that duplicates the documentation of DataContractAttribute on .Net 4.0 windows forms application that is defined here:
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.aspx
When creating a new .Net 4.0 windows forms application and pasting the DataContractAttribute example into it, this compile error is generated:
“Type ‘ ‘ is not defined” for DataContract, DataMember, IExtensibleDataObject, ExtensionDataObject, DataContractSerializer.
The MSDN documentation states that all of these should be available in the System.Runtime.Serialization namespace.
The only members available to me in the System.Runtime.Serialization namespace are IDeserializationCallback, IFormatter, IFormatterConverter, IOjbectReference, ISafeSerializationData, ISerializable, ISerializationSurrogate and ISurrogateSelector.
Importing System.Runtime.Serialization obviously doesn’t work neither does fully qualifying the references since the classes aren’t included in the namespace
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute.aspx
Namespace: System.Runtime.Serialization
Assembly: System.Runtime.Serialization (in System.Runtime.Serialization.dll)
You need to add reference to this assembly.