Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What version of .net are you running? .NET 4 Data Contract does not require you to explicitly set Ignore attributes. You can test what's being produced by using DataContractSerializer and writing the content to the file. Create console application and reference your service project.</p> <pre><code>namespace SO_10281928 { class Program { static void Main(string[] args) { var instance = new Stamp { Name = "Test", SmallIcon = "Small Icon", LargeIcon = "LargeIcon", MediumIcon = "MediumIcon" }; using (var stream = new FileStream(@"c:\temp\stamp.xml", FileMode.Create)) { var ds = new DataContractSerializer(typeof (Stamp)); ds.WriteObject(stream, instance); } Console.WriteLine("Done."); Console.ReadLine(); } } [DataContract] public class Stamp { private string _Name; private string _SmallIcon = ""; private string _MediumIcon = ""; private string _LargeIcon = ""; private BitmapImage _SmallImage; private BitmapImage _MediumImage; private BitmapImage _LargeImage; [DataMember] public string Name { get { return _Name; } set { _Name = value; } } [DataMember] public string SmallIcon { get { return _SmallIcon; } set { _SmallIcon = value; } } [DataMember] public string MediumIcon { get { return _MediumIcon; } set { _MediumIcon = value; } } [DataMember] public string LargeIcon { get { return _LargeIcon; } set { _LargeIcon = value; } } public BitmapImage SmallImage { get { return _SmallImage; } set { _SmallImage = value; } } public BitmapImage MediumImage { get { return _MediumImage; } set { _MediumImage = value; } } public BitmapImage LargeImage { get { return _LargeImage; } set { _LargeImage = value; } } } public class BitmapImage { } } </code></pre> <p>And the result is :</p> <pre><code>&lt;Stamp xmlns="http://schemas.datacontract.org/2004/07/SO_10281928" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;LargeIcon&gt;LargeIcon&lt;/LargeIcon&gt; &lt;MediumIcon&gt;MediumIcon&lt;/MediumIcon&gt; &lt;Name&gt;Test&lt;/Name&gt; &lt;SmallIcon&gt;Small Icon&lt;/SmallIcon&gt; &lt;/Stamp&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload