Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd implement some addtional serialzation behaviors as per this <a href="http://www.codeproject.com/KB/cs/objserial.aspx" rel="nofollow noreferrer">article</a>. If you want to get fancy, you can create a setting in your projects properties. This setting would determine if your class used csv or default serialialization. You'd then access it through the techniques shown <a href="http://msdn.microsoft.com/en-us/library/system.configuration.appsettingsreader.aspx" rel="nofollow noreferrer">here</a>. Consider using a static constructor to read appsettings and make a boolean value accessable to your serialization code. Vlads' code looks great, just plug it in to your code. Also you can consider other, maybe more desirable ways to change your serialzation behavior.</p> <p>Or Create an interface called 'SerializeAsCSV' and use it kind of like this:</p> <p>// Partial Contents of MyCoolClass.csv:</p> <pre><code> public class MyCoolClass : ISerializeAsCSV, IDisposable { protected static bool serializesToCSV = false; static MyCoolClass() { serializesToCSV = (typeof(MyCoolClass).GetInterface("GrooveySoft.Shared.Interfaces.ISerializeAsCSV") == null) ? false : true; } public MyCoolClass(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { // your stuff here } public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { // your stuff here } } </code></pre> <p>// contents of ISerializeAsCSV.cs</p> <pre><code>using System.Runtime.Serialization; namespace GrooveySoft.Shared.Interfaces { /// &lt;summary&gt; /// indicates that implementor will serialize to csv format /// &lt;/summary&gt; public interface ISerializeAsCSV : ISerializable { } } </code></pre> <p>This should get your started . . . I haven't compiled and tested this . . but you get the general idea.</p>
    singulars
    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.
    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