void WriteTypeFullName(TypeReference type, GenericTypeOptions options) { if (type.DeclaringType != null) { WriteTypeFullName(type.DeclaringType, options); id.Append('.'); } if (!string.IsNullOrEmpty(type.Namespace)) { id.Append(type.Namespace); id.Append('.'); } var name = type.Name; if (options.IsArgument) { var index = name.LastIndexOf('`'); if (index > 0) { name = name.Substring(0, index); } } id.Append(name); WriteGenericTypeParameters(type, options); }
void WriteGenericTypeParameters(TypeReference type, GenericTypeOptions options) { if (options.IsArgument && IsGenericType(type)) { id.Append('{'); WriteList(GetGenericTypeArguments(type, options), WriteTypeSignature); id.Append('}'); } }
IList <TypeReference> GetGenericTypeArguments(TypeReference type, GenericTypeOptions options) { if (options.IsNestedType) { var typeParameterCount = type.GenericParameters.Count; var typeGenericArguments = options.Arguments.Skip(options.ArgumentIndex).Take(typeParameterCount).ToList(); options.ArgumentIndex += typeParameterCount; return(typeGenericArguments); } return(options.Arguments); }
void WriteGenericInstanceTypeSignature(GenericInstanceType type) { if (type.ElementType.IsTypeSpecification()) { throw new NotSupportedException(); } GenericTypeOptions options = new GenericTypeOptions { IsArgument = true, IsNestedType = type.IsNested, Arguments = type.GenericArguments }; WriteTypeFullName(type.ElementType, options); }
void WriteTypeFullName(TypeReference type) { WriteTypeFullName(type, GenericTypeOptions.Empty()); }