diff Implab.ServiceHost/Unity/ArrayTypeReference.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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Implab.ServiceHost/Unity/ArrayTypeReference.cs	Thu May 03 09:59:44 2018 +0300
@@ -0,0 +1,57 @@
+using System;
+using System.Text;
+
+namespace Implab.ServiceHost.Unity {
+    public class ArrayTypeReference : TypeReference {
+        public int Rank { get; private set; }
+
+        public TypeReference ItemsType { get; private set; }
+
+        public override string Name {
+            get {
+                return ItemsType.Name;
+            }
+        }
+
+        public override string ClrName {
+            get {
+                return new StringBuilder()
+                    .Append(ItemsType.ClrName)
+                    .Append("[")
+                    .Append(',', Rank - 1)
+                    .Append("]")
+                    .ToString();
+            }
+        }
+
+        public override string Namespace {
+            get {
+                return ItemsType.Namespace;
+            }
+        }
+
+        public override int GenericParametersCount {
+            get {
+                return 0;
+            }
+        }
+
+        internal ArrayTypeReference(TypeReference itemsType, int rank) {
+            ItemsType = itemsType;
+            Rank = rank;
+        }
+
+        internal override void Visit(TypeResolutionContext visitor) {
+            visitor.Visit(this);
+        }
+
+        override public string ToString() {
+            return new StringBuilder()
+                .Append(ItemsType.ToString())
+                .Append('[')
+                .Append(',', Rank - 1)
+                .Append(']')
+                .ToString();
+        }
+    }
+}
\ No newline at end of file