Get Property Names - CSharp System.Reflection

CSharp examples for System.Reflection:PropertyInfo

Description

Get Property Names

Demo Code


using System.Reflection;
using System.Linq;
using System;/*w  w  w .  j  a va  2 s  .  c  o  m*/

public class Main{
        public static string[] GetPropertyNames(Type type)
        {
            PropertyInfo[] propertyInfos = type.GetProperties();
            return propertyInfos.Select(property => property.Name).ToArray();
        }
}

Related Tutorials