This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Console.WriteLine($"Mi nombre es {name} y tengo {age} años"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Console.WriteLine($"Mi nombre es {name} naci en {date:y} y tengo {age} años"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private int age; | |
| public int Age | |
| { | |
| get { return age; } | |
| set { age = value; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private int age = 30; | |
| public int Age | |
| { | |
| get { return age; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public string Name { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Order | |
| { | |
| public DateTime OrderDate { get; set; } = DateTime.Now; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public string FullName => $"{FirstName} {LastName}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nameof(FullName) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myCustomerList = new List<Customer>(); | |
| //rellenar customers: | |
| var myCustomerDataTable = myCustomerList.ConvertConvertToDataTable(prop=>!prop.PropertyType.IsGeneric); |