Пример #1
0
        /// <summary>
        /// Mark this field as the backing field of a field-like event.
        /// The caller will also ensure that it is excluded from the member list of
        /// the containing type (as it would be in source).
        /// </summary>
        internal void SetAssociatedEvent(PEEventSymbol eventSymbol)
        {
            Debug.Assert((object)eventSymbol != null);
            Debug.Assert(eventSymbol.ContainingType == _containingType);

            // This should always be true in valid metadata - there should only
            // be one event with a given name in a given type.
            if ((object)_associatedEventOpt == null)
            {
                // No locking required since this method will only be called by the thread that created
                // the field symbol (and will be called before the field symbol is added to the containing
                // type members and available to other threads).
                _associatedEventOpt = eventSymbol;
            }
        }
Пример #2
0
 /// <summary>
 /// Associate the method with a particular event. Returns
 /// false if the method is already associated with a property or event.
 /// </summary>
 internal bool SetAssociatedEvent(PEEventSymbol eventSymbol, MethodKind methodKind)
 {
     Debug.Assert((methodKind == MethodKind.EventAdd) || (methodKind == MethodKind.EventRemove));
     return this.SetAssociatedPropertyOrEvent(eventSymbol, methodKind);
 }
Пример #3
0
 /// <summary>
 /// Associate the method with a particular event. Returns
 /// false if the method is already associated with a property or event.
 /// </summary>
 internal bool SetAssociatedEvent(PEEventSymbol eventSymbol, MethodKind methodKind)
 {
     Debug.Assert((methodKind == MethodKind.EventAdd) || (methodKind == MethodKind.EventRemove));
     return(this.SetAssociatedPropertyOrEvent(eventSymbol, methodKind));
 }
Пример #4
0
        /// <summary>
        /// Mark this field as the backing field of a field-like event.
        /// The caller will also ensure that it is excluded from the member list of
        /// the containing type (as it would be in source).
        /// </summary>
        internal void SetAssociatedEvent(PEEventSymbol eventSymbol)
        {
            Debug.Assert((object)eventSymbol != null);
            Debug.Assert(eventSymbol.ContainingType == _containingType);

            // This should always be true in valid metadata - there should only
            // be one event with a given name in a given type.
            if ((object)_associatedEventOpt == null)
            {
                // No locking required since this method will only be called by the thread that created
                // the field symbol (and will be called before the field symbol is added to the containing 
                // type members and available to other threads).
                _associatedEventOpt = eventSymbol;
            }
        }