Boo.Lang.Compiler.TypeSystem.ArrayType.GetArrayRank C# (CSharp) Method

GetArrayRank() public method

public GetArrayRank ( ) : int
return int
        public int GetArrayRank()
        {
            return _rank;
        }

Usage Example

コード例 #1
0
        private Type GetSystemType(IType type)
        {
            // Get system type from external types
            if (type is ExternalType)
            {
                return(((ExternalType)type).ActualType);
            }

            // Get system array types from arrays of external types
            ArrayType arrayType = type as ArrayType;

            if (arrayType != null)
            {
                Type elementType = GetSystemType(arrayType.GetElementType());
                int  rank        = arrayType.GetArrayRank();

                // Calling MakeArrayType(1) gives a multi-dimensional array with 1 dimensions,
                // which is (surprisingly) not the same as calling MakeArrayType() which gives
                // a single-dimensional array
                return(rank == 1 ? elementType.MakeArrayType() : elementType.MakeArrayType(rank));
            }

            // This shouldn't happen since we only call GetSystemType on external types or arrays of such
            return(null);
        }
All Usage Examples Of Boo.Lang.Compiler.TypeSystem.ArrayType::GetArrayRank