Exemple #1
0
        private Type ReadType(DataKind kind)
        {
            switch (kind)
            {
            case DataKind.TypeRef_B:
                return((Type)_dataMap.GetValue(_reader.ReadByte()));

            case DataKind.TypeRef_S:
                return((Type)_dataMap.GetValue(_reader.ReadUInt16()));

            case DataKind.TypeRef:
                return((Type)_dataMap.GetValue(_reader.ReadInt32()));

            case DataKind.Type:
                int id           = _dataMap.GetNextId();
                var assemblyName = this.ReadString();
                var typeName     = this.ReadString();

                if (_binder == null)
                {
                    throw NoBinderException(typeName);
                }

                var type = _binder.GetType(assemblyName, typeName);
                _dataMap.AddValue(id, type);
                return(type);

            default:
                throw ExceptionUtilities.UnexpectedValue(kind);
            }
        }