Fill Array List with All properties of a class

  • Partner links

  • 3 Skype phone Mix & Match 100

    Following Method/function will return list of class properties in an array list.

    PropertyInfo class is is used to get the properties of the object passed to the method parameter. You may need to add System.Refelection directive in your page.

    I am using this in my web development. Microsoft c-sharp , .net, .aspx

    private ArrayList getPropertis(object obj)

    {Type objtype = obj.GetType();

    ArrayList arrayproperties = new ArrayList();foreach (PropertyInfo pi in objtype.GetProperties()){

    arrayproperties.Add(pi.Name);}return arrayproperties;}

    Nokia N95 8GB Black on MM300 AT 3mobile
    I Wan to share this post: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • bodytext
    • del.icio.us
    • Facebook
    • Mixx
    • Google
    • kick.ie
    • Live
    • MyShare
    • IndianPad
    • Reddit
    • StumbleUpon
    • Technorati
    • YahooMyWeb
    • description
    • description

    Tags: , , , , , ,

    Leave a Reply