Exemplo n.º 1
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="Event"/> class.
        /// </summary>
        /// <param name="extendedType">The extended type.</param>
        /// <param name="info">The event metadata.</param>
        internal Event([NotNull] ExtendedType extendedType, [NotNull] EventInfo info)
        {
            ExtendedType = extendedType;
            Info = info;
            _addMethod = new Lazy<MethodInfo>(() => info.GetAddMethod(true), LazyThreadSafetyMode.PublicationOnly);
            _removeMethod = new Lazy<MethodInfo>(() => info.GetRemoveMethod(true), LazyThreadSafetyMode.PublicationOnly);

            // Note events also support 'raise' and 'other' methods, neither of which are currently used in C#
            // Adding support is trivial (identical to above), but would create unnecessary overhead for all
            // but very edge cases (i.e. when working with types created in IL directly).
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes the <see cref="Constructor"/> class.
 /// </summary>
 /// <param name="extendedType">Type of the extended.</param>
 /// <param name="info">The info.</param>
 /// <remarks></remarks>
 internal Constructor([NotNull] ExtendedType extendedType, [NotNull] ConstructorInfo info)
 {
     ExtendedType = extendedType;
     Info = info;
     _parameters = new Lazy<ParameterInfo[]>(info.GetParameters, LazyThreadSafetyMode.PublicationOnly);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes the <see cref="Method"/> class.
 /// </summary>
 /// <param name="extendedType">Type of the extended.</param>
 /// <param name="info">The info.</param>
 /// <remarks></remarks>
 internal Method([NotNull] ExtendedType extendedType, [NotNull] MethodInfo info)
 {
     ExtendedType = extendedType;
     Info = info;
     _genericArguments = new Lazy<List<GenericArgument>>(
         () => info.GetGenericArguments()
             // ReSharper disable once AssignNullToNotNullAttribute
             .Select((g, i) => new GenericArgument(GenericArgumentLocation.Signature, i, g))
             .ToList(),
         LazyThreadSafetyMode.PublicationOnly);
     _parameters = new Lazy<ParameterInfo[]>(info.GetParameters, LazyThreadSafetyMode.PublicationOnly);
 }