samedi 24 novembre 2018

Identify if a Type is *either* of int or Nullable

Reflection code.

I can check if myTypeObject == typeof(decimal) || myTypeObject == typeof(decimal?)

Is there any way to do that without repeating decimal?

I'm guessing something along the lines of:

myRealTypeObject = myTypeObject.IsNullable() ? myTypeObject.GetTypeInsideNullability() : myTypeObject;
myRealTypeObject == typeof(decimal)





Aucun commentaire:

Enregistrer un commentaire