예제 #1
0
파일: TaggedData.cs 프로젝트: NeoTim/etch
        private Type GetComponentType(sbyte typeCode, XType customStructType, int dim)
        {
            Type c;

            if (typeCode == TypeCode.CUSTOM || typeCode == TypeCode.STRUCT)
            {
                //    c = GetCustomType( customStructType );
                c = customStructType.GetComponentType();
                if (c == null)
                {
                    c = typeof(StructValue);
                }
            }

            else
            {
                c = GetNativeType(typeCode);
            }
            //Console.WriteLine( "c = " + c );
            if (c == null)
            {
                return(null);
            }

            if (dim == 0)
            {
                return(c);
            }

            int[] dims;

            while (dim > 0)
            {
                dims = new int[dim];
                if (dim > 1)
                {
                    c = c.MakeArrayType();
                }
                dim--;
            }

            //Object o = Array.CreateInstance( c, 1 );

            //c = ( ( Array ) o ).GetType();
            //Console.WriteLine( "type= "+c );
            return(c);
        }