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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With