Exemple #1
0
        static SimpleTypesUtils()
        {
            Dv = new Dictionary <Type, ParserInfo>();

            if (StringParser == null)
            {
                StringParser = new ParseDelegator(GetSimpleTypeValue);
            }
            Dv.Add(typeof(string), new ParserInfo(StringParser, ""));

            if (BoolParser == null)
            {
                BoolParser = new ParseDelegator(ToBool);
            }
            Dv.Add(typeof(bool), new ParserInfo(BoolParser, false));

            if (SbyteParser == null)
            {
                SbyteParser = new ParseDelegator(ToSbyte);
            }
            Dv.Add(typeof(sbyte), new ParserInfo(SbyteParser, 0));

            if (ByteParser == null)
            {
                ByteParser = new ParseDelegator(ToByte);
            }
            Dv.Add(typeof(byte), new ParserInfo(ByteParser, 0));

            if (CharParser == null)
            {
                CharParser = new ParseDelegator(ToChar);
            }
            Dv.Add(typeof(char), new ParserInfo(CharParser, 0));

            if (ShortParser == null)
            {
                ShortParser = new ParseDelegator(ToShort);
            }
            Dv.Add(typeof(short), new ParserInfo(ShortParser, 0));

            if (UshortParser == null)
            {
                UshortParser = new ParseDelegator(ToUshort);
            }
            Dv.Add(typeof(ushort), new ParserInfo(UshortParser, 0));

            if (IntParser == null)
            {
                IntParser = new ParseDelegator(ToInt);
            }
            Dv.Add(typeof(int), new ParserInfo(IntParser, 0));

            Type arg_220_1 = typeof(uint);

            if (UintParser == null)
            {
                UintParser = new ParseDelegator(ToUint);
            }
            Dv.Add(typeof(uint), new ParserInfo(UintParser, 0u));

            if (LongParser == null)
            {
                LongParser = new ParseDelegator(ToLong);
            }
            Dv.Add(typeof(long), new ParserInfo(LongParser, 0L));

            if (UlongParser == null)
            {
                UlongParser = new ParseDelegator(ToUlong);
            }
            Dv.Add(typeof(ulong), new ParserInfo(UlongParser, 0uL));

            if (FloatParser == null)
            {
                FloatParser = new ParseDelegator(ToFloat);
            }
            Dv.Add(typeof(float), new ParserInfo(FloatParser, 0f));

            if (DoubleParser == null)
            {
                DoubleParser = new ParseDelegator(ToDouble);
            }
            Dv.Add(typeof(double), new ParserInfo(DoubleParser, 0.0));
        }
Exemple #2
0
 public ParserInfo(ParseDelegator parseDelegate, object defaultValue)
 {
     this.parseDelegate = parseDelegate;
     this.defaultValue  = defaultValue;
 }