Beispiel #1
0
        /// <summary>
        /// Returns a C#-like string that corresponds to the signature of the given event definition and that conforms to the specified formatting options.
        /// </summary>
        //^ [Pure]
        public virtual string GetEventSignature(IEventDefinition eventDef, NameFormattingOptions formattingOptions)
        {
            string result = eventDef.Name.Value;

            if ((formattingOptions & NameFormattingOptions.OmitContainingType) == 0)
            {
                result = _typeNameFormatter.GetTypeName(eventDef.ContainingType, formattingOptions) + "." + result;
            }
            return(result);
        }
Beispiel #2
0
        public static string GetTypeName(this ITypeReference type, NameFormattingOptions options)
        {
            TypeNameFormatter formatter = new TypeNameFormatter();
            string            name      = formatter.GetTypeName(type, options);

            return(name);
        }
Beispiel #3
0
        public static string GetTypeName(this ITypeReference type, bool includeNamespace = true)
        {
            TypeNameFormatter     formatter = new TypeNameFormatter();
            NameFormattingOptions options   = NameFormattingOptions.OmitTypeArguments | NameFormattingOptions.UseReflectionStyleForNestedTypeNames;

            if (!includeNamespace)
            {
                options |= NameFormattingOptions.OmitContainingNamespace;
            }

            string name = formatter.GetTypeName(type, options);

            return(name);
        }
Beispiel #4
0
 /// <summary>
 /// Returns an easy-to-read type name from the specified Type
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static string GetTypeName(this Type type)
 {
     return(_typeNameFormatter.GetTypeName(type));
 }
 public string GetTypeSignature(ITypeReference type)
 {
     return(_formatter.GetTypeName(type, (FormatOpts & ~NameFormattingOptions.OmitContainingType)));
 }