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.Runtime.CompilerServices; | |
| static class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| for (int i = 10; ; i += 10) | |
| { | |
| Console.WriteLine(i); | |
| try |
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
| SELECT | |
| a3.name AS [schemaname], | |
| a2.name AS [tablename], | |
| a1.rows as row_count, | |
| coalesce(a1.reserved, 0) * 8 AS reserved, | |
| a1.data * 8 AS data, | |
| a1.rodata * 8 AS rodata, | |
| a1.lobdata * 8 AS lobdata, | |
| (CASE WHEN (a1.used + ISNULL(a4.used, 0)) > a1.data THEN (a1.used + ISNULL(a4.used, 0)) - a1.data - a1.lobdata ELSE 0 END) * 8 AS index_size, |
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.Reflection; | |
| var x = GetParser<Thing>(); | |
| var y = GetParser<int>(); | |
| static IParser<T> GetParser<T>() | |
| { | |
| // specialize for T == Thing | |
| if (typeof(T) == typeof(Thing)) | |
| { |
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
| // Include nupkgs: Sylvan.Data, Sylvan.Data.Csv | |
| using Sylvan.Data; | |
| using Sylvan.Data.Csv; | |
| int count = 10000000;// controls how many records to write | |
| const string file = "dump.csv"; | |
| // "invert" the WriteCsvToStream code into a readable stream. | |
| using Stream stream = new InvertedStream((stream) => WriteCsvToStream(stream, count)); |
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.Data.SqlClient; | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var dbStr = args[0]; | |
| var srcTz = args[1]; | |
| var dstTz = args[2]; |
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 Npgsql; | |
| using NpgsqlTypes; | |
| using Sylvan.Data.Csv; | |
| using System.Collections.ObjectModel; | |
| using System.Data.Common; | |
| class Program | |
| { | |
| static async Task Main() | |
| { |
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 CsvHelper; | |
| using nietras.SeparatedValues; | |
| using RecordParser.Extensions; | |
| using Sylvan.Data; | |
| using Sylvan.Data.Csv; | |
| using System.Globalization; | |
| using System.Runtime.CompilerServices; | |
| var tw = new StringWriter(); | |
| tw.WriteLine("A,B,C,D"); |
This file has been truncated, but you can view the full file.
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
| AA | |
| AAH | |
| AAHED | |
| AAHING | |
| AAHS | |
| AAL | |
| AALII | |
| AALIIS | |
| AALS |
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.IO; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| sealed class MacOSTextReader : TextReader | |
| { | |
| readonly TextReader inner; | |
| public MacOSTextReader(TextReader inner) |
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
| // this is a reworking of the CsvFileResult code posted to the CSharp Reddit: | |
| // https://www.reddit.com/r/csharp/comments/12sip6r/oom_on_custom_fileresult_streaming_from_queryable/ | |
| using Microsoft.AspNetCore.Mvc; | |
| using System.Reflection; | |
| public class CSVFileResult<T> : FileResult where T : class | |
| { | |
| private readonly IQueryable<T> _data; |
NewerOlder