简体   繁体   中英

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>)){...}

要么

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM