Пример #1
0
        private DotNetDelegate ToDelegate()
        {
            DotNetDelegate _delegate = new DotNetDelegate(Name);

            _delegate.CopyComments(this);
            return(_delegate);
        }
Пример #2
0
 /// <summary>
 /// Converts the selected type into a delegate, transfering all applicable data.
 /// </summary>
 /// <remarks>
 /// If the <paramref name="name"/> refers to a nested type descendent, that type is the one converted.
 /// The nested type is removed from its parent and the new delegate is added in its place
 /// </remarks>
 /// <param name="name">The fully qualified name of the delegate.</param>
 /// <returns>The new delegate, or null if the type is not found.</returns>
 public DotNetDelegate ToDelegate(DotNetQualifiedName name)
 {
     if (Is(name))
     {
         return(ToDelegate());
     }
     else if (IsDirectChild(name))
     {
         DotNetType     subtype   = (DotNetType)GetDirectChild(name);
         DotNetDelegate _delegate = subtype.ToDelegate();
         NestedTypes.Remove(subtype);
         Delegates.Add(_delegate);
         return(_delegate);
     }
     else
     {
         foreach (DotNetType nestedType in NestedTypes)
         {
             if (nestedType.Owns(name))
             {
                 return(nestedType.ToDelegate(name));
             }
         }
     }
     return(null);
 }
        private void ConvertTypeToDelegate(Type type, DotNetQualifiedName qualifiedName, DotNetType dotNetType)
        {
            DotNetDelegate _delegate = dotNetType.ToDelegate(qualifiedName);

            if (dotNetType.Is(qualifiedName))
            {
                Types.Remove(dotNetType);
                Delegates.Add(_delegate);
            }
            _delegate.AddAssemblyInfo(type);
        }