摘要:
static void AnonymousSerializeDemo() { var data = new { firstPart = new { item1 = "item1", item2 = "item2", item3 = 10 }, secondPart = new { pp1 = new 阅读全文
摘要:
class Dirs { public string DirName { get; set; } public long DirSize { get; set; } } static void OrderFiles(string dir) { string[] dirs = Directory.Ge 阅读全文
摘要:
The piped stream are bidirectional communcation.Meanwhile they can read and write. Write the NamedPipeServerStream and NamedPipeClientStream in two di 阅读全文
摘要:
static DataTable ReadExcelConvertToDataTable(string xlsxFileName) { DataTable dt = new DataTable(); try { IWorkbook book; using (FileStream fs = new F 阅读全文
摘要:
1.Install-package npoi; 2.Add necessary namespace as below. using System.IO;using System.IO.Compression;using NPOI.HSSF.UserModel;using NPOI.SS.UserMo 阅读全文
摘要:
Write the current to the local file. static void CopyStream(Stream stream, string destPath) { using (var fileStream = new FileStream(destPath, FileMod 阅读全文
摘要:
static void AssemblyLoadContextDemo() { var assms = AssemblyLoadContext.All.SelectMany(x => x.Assemblies); if(assms!=null && assms.Any()) { foreach(va 阅读全文
摘要:
1.Add resource file Resource1.resx via add new item in Console Application project; 2.Open Resource1.resx, Add Resource/Add Existing File, add multipl 阅读全文
摘要:
1.Add new folder Resources in project; 2.Add resource such as picture in the Resource folder; 3.Set the picture's Build Action as Embedded Resource in 阅读全文
摘要:
static void ComputeCodeLines() { string dir = @"D:\Work"; int totalLines = 0; string[] allFiles = Directory.GetFiles(dir, "*.cs", SearchOption.AllDire 阅读全文