How to count this DataSources
class properties? Answer should be '3'
public class DataSources
{
public int Id { get; set; }
public string Name { get; set; }
public string Phone { get; set; }
}
You can investigate type metadata with classes found in System.Reflection namespace. In your case TypeInfo -class is one which help you when getting information about properties.
using System.Linq;
typeof(DataSources).GetProperties().Count();
Or
typeof(DataSources).GetProperties().Length;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.