C# working with decorated members

Posted by Ronnie Overby on Stack Overflow See other posts from Stack Overflow or by Ronnie Overby
Published on 2010-04-30T18:27:35Z Indexed on 2010/04/30 18:37 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

Take this class for example:

public class Applicant : UniClass<Applicant>
{
    [Key]
    public int Id { get; set; }

    [Field("X.838.APP.SSN")]
    public string SSN { get; set; }

    [Field("APP.SORT.LAST.NAME")]
    public string FirstName { get; set; }

    [Field("APP.SORT.FIRST.NAME")]
    public string LastName { get; set; }

    [Field("X.838.APP.MOST.RECENT.APPL")]
    public int MostRecentApplicationId { get; set; }
}

How would I go about getting all of the properties that are decorated with the field attribute, get their types, and then assign a value to them?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET