开发者

C# reflection getting nullable type

i have class, with fields of double? type. with reflection i get fields

Parameters cl = new Parameters();
FieldInfo[] fi = cl.GetType().GetFields((BindingFlags.NonPublic | BindingFlags.Instance));

now, i want get fields, only with double? type, gow can i get this type, to compare with fields from fi?

smth like:

开发者_开发知识库
if(fi[0].FieldType == (double?).GetType()){...}


if(fi[0].FieldType == typeof(Nullable<double>)){...}

or

if(fi[0].FieldType == typeof(double?)){...}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜