您好b $ b 有可能获得例如来自字符串值 System.Int16 struct 短, 或例如从System.Single我需要 struct float 。 我不是指使用Type.GetType(System.Int16) - 这是不同的事情(因为它返回类型,但我需要 struct ) 我上传我的意思(不同) postimg/image/ouy2xhzjr/ [ ^ ] 存在任何可以使用的方法 (method1(short))12 或(method1(System.Int16))12 而不是 (短)12 谢谢
解决方案Int16 and short不一样...... short是一个表示C#语言的INTEGRAL类型的关键字(而不是.NET faremwork的类型),其中Int16是.NET框架类型。 确实两者都代表一个16位的有符号整数,但这都是...... 你不能写一个并期望得到另一个... 两种不同类型的原因是.NET框架可以使用不同的语言,如PHP或COBOL,其中short不是一个选项。 ..但那些语言也使用Int16,根据定义独立于语言......
你可以使用 typeof : typeof ( short )
Hi It is possible get e.g. from string value "System.Int16" struct short, or e.g. from "System.Single" I need struct float. I don't mean use Type.GetType("System.Int16") - this is different thing (because it return Type, but I need struct) I upload what I mean (different) postimg/image/ouy2xhzjr/[^] Exist any method who can use (method1("short"))12 or (method1("System.Int16"))12 instead (short)12 Thank you
解决方案 Int16 and short ARE NOT the same... short is a keyword that represents an INTEGRAL type of the C# language (and not a type of the .NET faremwork), where Int16 is a .NET framework type. It is true that both are representing a 16 bit usigned integer, but that's all... You can not write the one and expecting to get the other... The reason for the two different types is that .NET framework can be used from different languages, like PHP or COBOL, where short not an option...but those languages too an use Int16, that by definition independent of languages...You can use typeof: typeof(short)更多推荐
如何从struct name获取struct?
发布评论