vendredi 22 janvier 2016

Get all data members which have DateTime as datatype in an object [duplicate]

This question already has an answer here:

I have sucked while generalizing a part of code where I need to get the name of all the Data Members which have DateTime as DataType.

Assume this to be a class:

public class SurveyResponseRaw
{
    public string ID { get; set; }
    public bool IsFinished { get; set; }
    public DateTime TerminationDate { get; set; }//DateTime
    public DateTime AssignedDate { get; set; }//DateTime
    public DateTime TeamBTerminationDate { get; set; }//DateTime
}

Now, I want all the Datamembers with DateTime datatype.

Is it possible to get this?

I have heard that this could be done with Reflection. Please let me know how.





Aucun commentaire:

Enregistrer un commentaire