This file contains 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 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 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 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 | |
AARDVARK |
This file contains 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 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; |
This file contains 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
// A C# solution to the PowerShell Excel->JSON conversion described in this blog post: | |
// https://devblogs.microsoft.com/powershell-community/convert-specific-table-of-excel-sheet-to-json/ | |
// Using the Sylvan data libaries. | |
using Sylvan.Data; | |
using Sylvan.Data.Excel; | |
if (args.Length != 3) | |
{ | |
Console.WriteLine("Args: file sheet \"class name\""); |
This file contains 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
// C# 11 and .NET 6+ | |
using Sylvan.Data; // 0.2.12-B0001 | |
using Sylvan.Data.Csv; // 1.2.7 | |
// the schema for the csv data below. | |
var schema = | |
new Schema.Builder() | |
// ID is required! | |
.Add<int>("Id") |
This file contains 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.Collections; | |
using System.Collections.ObjectModel; | |
using System.Data.Common; | |
using System.Diagnostics; | |
var rand = new Random(); | |
var data = | |
Enumerable | |
.Range(0, 10000000) |
This file contains 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 Sylvan.Data.Excel; | |
using var r = ExcelDataReader.Create("Data.xlsx"); | |
r.WriteHtmlTable(Console.Out); | |
static class DataExtensions | |
{ | |
public static long WriteHtmlTable(this System.Data.Common.DbDataReader data, TextWriter writer) | |
{ | |
long count = 0; |
NewerOlder