可能获得在C#中的别名类型的类型? [英] Possible to get type of an aliased type in c#?

查看:121
本文介绍了可能获得在C#中的别名类型的类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Type.GetType("System.String")

是否有可用的地方别名查找?

Is there a lookup for the aliases available somewhere?

Type.GetType("string")

收益

推荐答案

由于别名是在C#中引入的关键字,其实这是不可能的编程方式,以及 Type.GetType ( 。像其他的框架方法)是与语言无关的框架的一部分。

This is not possible programmatically, since the 'aliases' are in fact keywords introduced in C#, and Type.GetType (like every other framework method) is part of the language-independent framework.

您可以创建具有以下值的字典:

You could create a dictionary with the following values:

    bool      System.Boolean
    byte      System.Byte
    sbyte     System.SByte
    char      System.Char
    decimal   System.Decimal
    double    System.Double
    float     System.Single
    int       System.Int32
    uint      System.UInt32
    long      System.Int64
    ulong     System.UInt64
    object    System.Object
    short     System.Int16
    ushort    System.UInt16
    string    System.String

这篇关于可能获得在C#中的别名类型的类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆