Skip to content

Instantly share code, notes, and snippets.

Console.WriteLine($"Mi nombre es {name} y tengo {age} años");
Console.WriteLine($"Mi nombre es {name} naci en {date:y} y tengo {age} años");
private int age;
public int Age
{
get { return age; }
set { age = value; }
}
private int age = 30;
public int Age
{
get { return age; }
}
public string Name { get; set; }
public class Order
{
public DateTime OrderDate { get; set; } = DateTime.Now;
}
public string FullName => $"{FirstName} {LastName}";
nameof(FullName)
public static class IEnumerableExtensions
{
public static DataTable ConvertToDataTable<T>(this IEnumerable<T> rows, Func<PropertyInfo, bool> filter)
{
var type = typeof(T);
if (type is DataRow) return rows.ConvertToDataTable();
var properties = filter == null? type.GetProperties().ToList() : type.GetProperties().Where(filter).ToList();
var table = BuildTable(type, properties);
var myCustomerList = new List<Customer>();
//rellenar customers:
var myCustomerDataTable = myCustomerList.ConvertConvertToDataTable(prop=>!prop.PropertyType.IsGeneric);