【发布时间】:2011-04-30 14:01:34
【问题描述】:
有没有办法从给定的字符串输入中检测类型?
例如:
string input = "07/12/1999";
string DetectType( s ) { .... }
Type t = DetectType(input); // which would return me the matched datatype. i.e. "DateTime" in this case.
我必须从头开始写这个吗?
只是想在我开始之前检查是否有人知道更好的方法。
谢谢!
【问题讨论】:
-
你需要自己写这个......让我想知道你为什么需要那个......
标签: c# .net string .net-4.0 types