コード例 #1
0
 public AnyTypeSpecifier(object prototype)
 {
     System.Type type = prototype.GetType();
     this.Type = type;
     if (!type.IsArray)
     {
         if (type != typeof(string))
         {
             this.Category    = DataTypeCategory.Primitive;
             this.StrLen      = -1;
             this.DimLengths  = null;
             this.ElementType = null;
         }
         else
         {
             string str = (string)prototype;
             this.Category    = DataTypeCategory.String;
             this.StrLen      = str.Length;
             this.DimLengths  = null;
             this.ElementType = null;
         }
     }
     else
     {
         Array array     = (Array)prototype;
         int   rank      = array.Rank;
         int[] indices   = new int[rank];
         int[] numArray2 = new int[rank];
         DimensionCollection dimensions = new DimensionCollection();
         for (int i = 0; i < rank; i++)
         {
             indices[i]   = array.GetLowerBound(i);
             numArray2[i] = array.GetLength(i);
             dimensions.Add(new Dimension(indices[i], numArray2[i]));
         }
         this.Category   = DataTypeCategory.Array;
         this.StrLen     = -1;
         this.DimLengths = new List <IDimensionCollection> {
             dimensions.AsReadOnly()
         }.AsReadOnly();
         System.Type elementType = this.Type.GetElementType();
         if (array.Length <= 0)
         {
             this.ElementType = new AnyTypeSpecifier(elementType);
         }
         else
         {
             object obj2 = array.GetValue(indices);
             this.ElementType = new AnyTypeSpecifier(obj2);
         }
     }
 }
コード例 #2
0
 public ReadOnlyDimensionCollection(DimensionCollection coll) : base(coll)
 {
 }