Example #1
0
        public ToObjectDelegate <T> GetToObject <T>()
        {
            var type = typeof(T);

            if (!ToObjectMap.ContainsKey(type))
            {
                var builder = BuilderManager.GetOrAddBuilder(type);
                ToObjectMap.TryAdd(type, builder.BuildToObject(LittleEndian));
            }
            return((ToObjectDelegate <T>)ToObjectMap[type]);
        }
Example #2
0
        public GetBytesDelegate <T> GetGetBytes <T>()
        {
            var type = typeof(T);

            if (!GetBytesMap.ContainsKey(type))
            {
                var builder = BuilderManager.GetOrAddBuilder(type);
                GetBytesMap.TryAdd(type, builder.BuildGetBytes(LittleEndian));
            }
            return((GetBytesDelegate <T>)GetBytesMap[type]);
        }