~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to contrib/Mono.Cecil/Mono.Cecil/Mono.Cecil/IGenericInstance.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
 
// IGenericInstanceMethod.cs
 
2
// IGenericInstance.cs
3
3
//
4
4
// Author:
5
5
//   Jb Evain (jbevain@gmail.com)
6
6
//
7
 
// (C) 2005 Jb Evain
 
7
// Copyright (c) 2008 - 2010 Jb Evain
8
8
//
9
9
// Permission is hereby granted, free of charge, to any person obtaining
10
10
// a copy of this software and associated documentation files (the
26
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
27
//
28
28
 
 
29
using System.Text;
 
30
 
 
31
using Mono.Collections.Generic;
 
32
 
29
33
namespace Mono.Cecil {
30
34
 
31
35
        public interface IGenericInstance : IMetadataTokenProvider {
32
36
 
33
 
                GenericArgumentCollection GenericArguments { get; }
34
 
 
35
37
                bool HasGenericArguments { get; }
 
38
                Collection<TypeReference> GenericArguments { get; }
 
39
        }
 
40
 
 
41
        static partial class Mixin {
 
42
 
 
43
                public static bool ContainsGenericParameter (this IGenericInstance self)
 
44
                {
 
45
                        var arguments = self.GenericArguments;
 
46
 
 
47
                        for (int i = 0; i < arguments.Count; i++)
 
48
                                if (arguments [i].ContainsGenericParameter)
 
49
                                        return true;
 
50
 
 
51
                        return false;
 
52
                }
 
53
 
 
54
                public static void GenericInstanceFullName (this IGenericInstance self, StringBuilder builder)
 
55
                {
 
56
                        builder.Append ("<");
 
57
                        var arguments = self.GenericArguments;
 
58
                        for (int i = 0; i < arguments.Count; i++) {
 
59
                                if (i > 0)
 
60
                                        builder.Append (",");
 
61
                                builder.Append (arguments [i].FullName);
 
62
                        }
 
63
                        builder.Append (">");
 
64
                }
36
65
        }
37
66
}