I have a date-time variable like this:
DateTime myDate=DateTime.Now; // result is like this: 8/2/2020 12:54:07 PM
and I want to get myDate variable like this
DateTime getOnlyDate=myDate.Date;
and I want to get myDate.Date; with reflection
how can I get Date property value with reflection?
with reflection I do something like this:
PropertyInfo myDate = typeof(DateTime).GetProperty("Date");
but I don`t know how can I request myDate.Date; value with reflection.
thanks in advance
myDate.GetValue(myDate);myDatecan't simultaneously be aPropertyInfoand aDateTime. I realize that's a problem in the OP's code, but it would be better not to propagate it into a comment.