Get Underlying Type - CSharp System

CSharp examples for System:Type

Description

Get Underlying Type

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Reflection;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
using System;/*from ww  w .  java 2s.co m*/

public class Main{
        public static Type GetUnderlyingType(Type arrayType)
        {
            if (!IsArray(arrayType))
                throw new NotImplementedException();
            
            return arrayType.GetGenericArguments()[0];
        }
}

Related Tutorials