Mercurial > pub > ImplabNet
comparison Implab.ServiceHost/Unity/SpecializedTypeReference.cs @ 278:6691aff01de1 v3
Implab: added XmlDefaultSeializer (SerializersPool is now obsolete)
Implab.ServiceHost: rewritten TypeReference (added support for nested types), stable API
author | cin |
---|---|
date | Thu, 03 May 2018 09:59:44 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
277:963b17c275be | 278:6691aff01de1 |
---|---|
1 using System; | |
2 using System.Linq; | |
3 using System.Text; | |
4 | |
5 namespace Implab.ServiceHost.Unity { | |
6 public class SpecializedTypeReference : TypeReference { | |
7 public override string Name { | |
8 get { | |
9 return GenericType.Name; | |
10 } | |
11 } | |
12 | |
13 public override string Namespace { | |
14 get { | |
15 return GenericType.Namespace; | |
16 } | |
17 } | |
18 | |
19 public override int GenericParametersCount { | |
20 get { | |
21 return GenericParameters.Length; | |
22 } | |
23 } | |
24 | |
25 public TypeReference GenericType { get; private set; } | |
26 | |
27 public TypeReference[] GenericParameters { get; private set; } | |
28 | |
29 internal SpecializedTypeReference(TypeReference genericType, TypeReference[] genericParameters) { | |
30 GenericType = genericType; | |
31 GenericParameters = genericParameters; | |
32 } | |
33 | |
34 internal override void Visit(TypeResolutionContext visitor) { | |
35 visitor.Visit(this); | |
36 } | |
37 | |
38 internal override void WriteTypeName(StringBuilder builder) { | |
39 GenericType.WriteTypeName(builder); | |
40 } | |
41 | |
42 internal override void WriteTypeParams(StringBuilder builder) { | |
43 builder.Append('{'); | |
44 for (var i = 0; i < GenericParameters.Length; i++) { | |
45 if (i > 0) | |
46 builder.Append(','); | |
47 builder.Append(GenericParameters[i]); | |
48 } | |
49 builder.Append('}'); | |
50 } | |
51 } | |
52 } |