/Mono.Cecil/IGenericInstance.cs
C# | 48 lines | 29 code | 10 blank | 9 comment | 4 complexity | d8513e35cc2ceeb0b7f2ef439502d762 MD5 | raw file
1// 2// Author: 3// Jb Evain (jbevain@gmail.com) 4// 5// Copyright (c) 2008 - 2015 Jb Evain 6// Copyright (c) 2008 - 2011 Novell, Inc. 7// 8// Licensed under the MIT/X11 license. 9// 10 11using System.Text; 12 13using Mono.Collections.Generic; 14 15namespace Mono.Cecil { 16 17 public interface IGenericInstance : IMetadataTokenProvider { 18 19 bool HasGenericArguments { get; } 20 Collection<TypeReference> GenericArguments { get; } 21 } 22 23 static partial class Mixin { 24 25 public static bool ContainsGenericParameter (this IGenericInstance self) 26 { 27 var arguments = self.GenericArguments; 28 29 for (int i = 0; i < arguments.Count; i++) 30 if (arguments [i].ContainsGenericParameter) 31 return true; 32 33 return false; 34 } 35 36 public static void GenericInstanceFullName (this IGenericInstance self, StringBuilder builder) 37 { 38 builder.Append ("<"); 39 var arguments = self.GenericArguments; 40 for (int i = 0; i < arguments.Count; i++) { 41 if (i > 0) 42 builder.Append (","); 43 builder.Append (arguments [i].FullName); 44 } 45 builder.Append (">"); 46 } 47 } 48}