// /** // * File: JSONMapping.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; namespace ln.json.mapping { public class JSONMapping { public Type TargetType { get; } Func tojson; Func fromjson; public JSONMapping(Type targetType,Func tojson, Func fromjson) { TargetType = targetType; this.fromjson = fromjson; this.tojson = tojson; } protected JSONMapping(Type targetType) { TargetType = targetType; } public virtual object FromJson(JSONMapper mapper,JSONValue json) { return fromjson(mapper, json); } public virtual JSONValue ToJson(JSONMapper mapper,object value) { return tojson(mapper, value); } } }