private static FieldInfo GetFieldInfoForType(Type type, string token, XmlNode debugXmlNode)
        {
            Dictionary <string, FieldInfo> dictionary = DirectXmlToObject.fieldInfoLookup.TryGetValue(type, null);

            if (dictionary == null)
            {
                dictionary = new Dictionary <string, FieldInfo>();
                DirectXmlToObject.fieldInfoLookup[type] = dictionary;
            }
            FieldInfo fieldInfo = dictionary.TryGetValue(token, null);

            if (fieldInfo == null && !dictionary.ContainsKey(token))
            {
                fieldInfo = DirectXmlToObject.SearchTypeHierarchy(type, token, BindingFlags.Default);
                if (fieldInfo == null)
                {
                    fieldInfo = DirectXmlToObject.SearchTypeHierarchy(type, token, BindingFlags.IgnoreCase);
                    if (fieldInfo != null && !type.HasAttribute <CaseInsensitiveXMLParsing>())
                    {
                        string text = string.Format("Attempt to use string {0} to refer to field {1} in type {2}; xml tags are now case-sensitive", token, fieldInfo.Name, type);
                        if (debugXmlNode != null)
                        {
                            text = text + ". XML: " + debugXmlNode.OuterXml;
                        }
                        Log.Error(text, false);
                    }
                }
                dictionary[token] = fieldInfo;
            }
            return(fieldInfo);
        }