using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Data.SqlClient;
using System.Globalization;
public static class EXT {
public static object DefaultValue(this Type type)
return type.IsValueType ? Activator.CreateInstance(type) : null;
public class ExampleClass
public string Id { get; set; }
public string Title { get; set; }
public decimal Price { get; set; }
public IEnumerable<PropertyInfo> GetDefaultProperty()
return from prop in GetType().GetProperties()
let value = prop.GetValue(this, null)
where !Equals(value, prop.PropertyType.DefaultValue())
public static void Main()
ExampleClass c = new ExampleClass();
foreach (var item in c.GetDefaultProperty())
Console.WriteLine(item.Name);