Exemplo n.º 1
0
 internal void ClearReflectionCache()
 {
     _tyname         = new SafeDictionary <Type, string>();
     _typecache      = new SafeDictionary <string, Type>();
     _constrcache    = new SafeDictionary <Type, CreateObject>();
     _getterscache   = new SafeDictionary <Type, Getters[]>();
     _propertycache  = new SafeDictionary <string, Dictionary <string, myPropInfo> >();
     _genericTypes   = new SafeDictionary <Type, Type[]>();
     _genericTypeDef = new SafeDictionary <Type, Type>();
 }
Exemplo n.º 2
0
        private static bool TryGetOpCode(short code, out OpCode opCode)
        {
            if (_opCodes != null)
            {
                return(_opCodes.TryGetValue(code, out opCode));
            }
            SafeDictionary <short, OpCode> dict = new SafeDictionary <short, OpCode>();

            foreach (FieldInfo fi in typeof(OpCodes).GetFields(BindingFlags.Public | BindingFlags.Static))
            {
                if (!typeof(OpCode).IsAssignableFrom(fi.FieldType))
                {
                    continue;
                }
                OpCode innerOpCode = (OpCode)fi.GetValue(null);
                if (innerOpCode.OpCodeType != OpCodeType.Nternal)
                {
                    dict.Add(innerOpCode.Value, innerOpCode);
                }
            }
            _opCodes = dict;
            return(_opCodes.TryGetValue(code, out opCode));
        }
Exemplo n.º 3
0
        //private static bool IsAnonymousType(Type type)
        //{
        //    // may break in the future if compiler defined names change...
        //    const string CS_ANONYMOUS_PREFIX = "<>f__AnonymousType";
        //    const string VB_ANONYMOUS_PREFIX = "VB$AnonymousType";

        //    if (type == null)
        //        throw new ArgumentNullException("type");

        //    if (type.Name.StartsWith(CS_ANONYMOUS_PREFIX, StringComparison.Ordinal) || type.Name.StartsWith(VB_ANONYMOUS_PREFIX, StringComparison.Ordinal))
        //    {
        //        return type.IsDefined(typeof(CompilerGeneratedAttribute), false);
        //    }

        //    return false;
        //}
        #endregion

        internal void ResetPropertyCache()
        {
            _propertycache = new SafeDictionary <string, Dictionary <string, myPropInfo> >();
        }