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
| using System; | |
| using System.Threading; | |
| static class Program { | |
| static void Main() { | |
| Console.Write("Performing some task... "); | |
| using (var progress = new ProgressBar()) { | |
| for (int i = 0; i <= 100; i++) { | |
| progress.Report((double) i / 100); |
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
| // Simple example for | |
| // 1.) Read a sql server query to datatable; | |
| // 2.) Export it to .csv | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var connectionString = @"data source=bla bla bla"; | |
| var selectQuery = "select * from my-table;"; |
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
| /// <summary> | |
| /// Utilties for reflection | |
| /// </summary> | |
| public static class ReflectionUtils | |
| { | |
| /// <summary> | |
| /// Get all the fields of a class | |
| /// </summary> | |
| /// <param name="type">Type object of that class</param> | |
| /// <returns></returns> |
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 BaseRepository<T> : IBaseRepository<T> where T : class | |
| { | |
| protected DbContext _context; | |
| /// <summary> | |
| /// The contructor requires an open DataContext to work with | |
| /// </summary> | |
| /// <param name="context">An open DataContext</param> | |
| public BaseRepository(DbContext context) | |
| { |
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 async Task TareaAsync() | |
| { | |
| var piedra = Task.Run(() => | |
| { | |
| Thread.Sleep(3000); | |
| }); | |
| var papel = Task.Run(() => | |
| { | |
| Thread.Sleep(3000); | |
| }); |