Exemplo n.º 1
0
    public void Converters()
    {
        JsonSerialiser aSerializer = new SerialiseType();

        JsonReflector.Add(typeof(A), aSerializer);
        Assert.AreEqual(@"TestReflection+A", JsonReflector.Reflect(new A()));
        Assert.AreEqual(@"TestReflection+B", JsonReflector.Reflect(new B()));
    }
Exemplo n.º 2
0
 private Serialiser(SerialiseType type)
 {
     _type = type;
     if (type == SerialiseType.Binary)
     {
         _fmt = new BinaryFormatter();
     }
     else if (type == SerialiseType.Json)
     {
         _fmt = new JsonFormatter();
     }
     else
     {
         _fmt = new XmlFormatter(typeof(T));
     }
 }