예제 #1
0
        public void Write <TT>(TT value)
        {
            TypeBinaryDict writers = Utils.InitTypes();

            writers.AddRange(BinaryRuntime.Gets());

            foreach (IBinary reader in writers)
            {
                if (reader.OutputType == typeof(TT))
                {
                    var b = reader as Binary <TT>;
                    b.OnWrite(this, value);
                }
            }
        }
예제 #2
0
        //[DebuggerStepThrough]
        public TT Read <TT>()
        {
            TypeBinaryDict readers = Utils.InitTypes();

            readers.AddRange(BinaryRuntime.Gets());

            foreach (IBinary reader in readers)
            {
                if (reader.OutputType == typeof(TT))
                {
                    var r = reader as Binary <TT>;
                    return(r.OnRead(this));
                }
            }
            return(default(TT));
        }