Esempio n. 1
0
        private static CustomMarshalAsAttribute GetCustomAttr(Type t, FieldInfo[] fields, int fieldIdx)
        {
            if (!m_CustomAttrCache.ContainsKey(t))
            {
                var arr = new CustomMarshalAsAttribute[fields.Length];

                for (int i = 0; i < fields.Length; i++)
                {
                    arr[i] = GetCustomAttr(fields[i]);
                }

                m_CustomAttrCache.Add(t, arr);
            }

            return(m_CustomAttrCache[t][fieldIdx]);
        }
Esempio n. 2
0
        private static CustomMarshalAsAttribute GetCustomAttr(Type t, FieldInfo[] fields, int fieldIdx)
        {
            lock (m_CustomAttrCache)
            {
                if (!m_CustomAttrCache.ContainsKey(t))
                {
                    var arr = new CustomMarshalAsAttribute[fields.Length];

                    for (int i = 0; i < fields.Length; i++)
                        arr[i] = GetCustomAttr(fields[i]);

                    m_CustomAttrCache.Add(t, arr);
                }

                return m_CustomAttrCache[t][fieldIdx];
            }
        }