Ejemplo n.º 1
0
        /// <summary>
        /// Gets the metadata for the given interface type.
        /// </summary>
        /// <param name="type">The interface type.</param>
        /// <returns>Its metadata.</returns>
        public static InterfaceMetadata GetValue(Type type)
        {
            if (Cache.TryGetValue(type, out var value))
            {
                return(value);
            }

            value = new InterfaceMetadata(type);
            Cache.TryAdd(type, value);
            return(value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RcwTypeMetadata"/> class.
        /// </summary>
        /// <param name="type">The implementation type.</param>
        public RcwTypeMetadata(Type type)
        {
            var parent = type.GetInterfaces().OrderBy(t => t.GetInterfaces().Length).LastOrDefault();

            this.VirtualTableSize = InterfaceMetadata.GetValue(parent).VirtualTableSize;
        }