随笔分类 -  C#

摘要:使用 C# 中的 `System.IO` 和 `Microsoft.Office.Interop.Excel` 库来实现读取文本文件和写入 Excel 文件。 以下是一个示例代码: 1 using System; 2 using System.IO; 3 using System.Windows.F 阅读全文
posted @ 2023-06-13 14:36 羽小兮 阅读(591) 评论(0) 推荐(0)
摘要:原字符串:“0,13,1:0,12,0:1,2,1:1,1,0” 要求输出字符串(降序): 1 string input = "0,13,1:0,12,0:1,2,1:1,1,0"; 2 SortedDictionary<int, SortedDictionary<int, int>> dict = 阅读全文
posted @ 2023-05-16 14:47 羽小兮 阅读(77) 评论(0) 推荐(0)
摘要:在对文件进行io操作时,如果在循环中使用了try catch块,那么如果catch抛出异常次数过多会加长程序运行的时间, 所以尽可能用if条件过滤需求,减少catch的次数。 阅读全文
posted @ 2023-01-06 15:06 羽小兮 阅读(87) 评论(0) 推荐(0)
摘要:1: .Net Reacter: 针对.net程序进行保护的专门工具 官网地址:https://www.eziriz.com/dotnet_reactor.htm 主要功能如下: 源码混淆处理 字符串加密 NET Reactor强大的许可授权管理功能 NET Reactor可以为您的软件创建试用版 阅读全文
posted @ 2022-12-29 17:49 羽小兮 阅读(5228) 评论(0) 推荐(1)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace 写 阅读全文
posted @ 2022-08-02 09:17 羽小兮 阅读(202) 评论(0) 推荐(0)
摘要:父窗口: <Window x:Class="子窗口显示在父窗口中间.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/ 阅读全文
posted @ 2022-07-12 15:01 羽小兮 阅读(1813) 评论(0) 推荐(0)
摘要:using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Folding; using ICSharpCode.NRefactory.Editor; using System; using System.Collectio 阅读全文
posted @ 2022-07-12 14:29 羽小兮 阅读(219) 评论(0) 推荐(0)
摘要:bool createNew; Process process = Process.GetCurrentProcess(); Mutex mutex = new Mutex(true, "CMS IDE", out createNew); if (!createNew) { foreach (Pro 阅读全文
posted @ 2022-07-12 14:19 羽小兮 阅读(279) 评论(0) 推荐(0)
摘要:引入log4.net包:VS导航栏 工具->NuGet 包管理器->管理解决方案的NuGet 程序包 搜索log4net 安装 加一个log4.net 的配置文件,命名为log4net.config,属性设置为如果较新则复制到输出目录 <log4net> <logger name="logerror 阅读全文
posted @ 2022-07-12 14:13 羽小兮 阅读(363) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace 读 阅读全文
posted @ 2022-07-12 11:31 羽小兮 阅读(346) 评论(0) 推荐(0)
摘要:using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 字符串转日期的 阅读全文
posted @ 2022-07-12 11:25 羽小兮 阅读(1332) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tas 阅读全文
posted @ 2022-07-12 11:23 羽小兮 阅读(122) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 字典转树形结构 { class Program 阅读全文
posted @ 2022-07-12 11:21 羽小兮 阅读(87) 评论(0) 推荐(0)
摘要:using System.IO; string str1 = Path.GetFileName("C:\\Silverlight\\sss.exe"); // sss.exe string str2 = Path.GetFileNameWithoutExtension("C:\\Silverligh 阅读全文
posted @ 2022-07-12 11:09 羽小兮 阅读(103) 评论(0) 推荐(0)
摘要:FileStream 构造函数可以有四个参数: String, FileMode, FileAccess, FileShare, 第一个参数表示路径。后面三个参数如下: FileMode CreateNew 创建新的。文件若存在,则异常。 Create 创建新的。文件若存在,则覆盖。 Open 打开 阅读全文
posted @ 2022-07-12 11:07 羽小兮 阅读(541) 评论(0) 推荐(0)
摘要:var utf8WithoutBom = new UTF8Encoding(false); StreamWriter writer = new StreamWriter(stream, utf8WithoutBom); //写文件内容的操作 //...... writer.Close(); 阅读全文
posted @ 2022-07-12 11:05 羽小兮 阅读(507) 评论(0) 推荐(0)
摘要:// 读取文件的创建、修改、访问时间 FileInfo fi = new FileInfo("C:\\test.txt"); Console.WriteLine(fi.CreationTime.ToString()); Console.WriteLine(fi.LastWriteTime.ToStr 阅读全文
posted @ 2022-07-12 10:59 羽小兮 阅读(421) 评论(0) 推荐(0)
摘要:<Window x:Class="按钮测试enter键.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/ 阅读全文
posted @ 2022-07-01 17:04 羽小兮 阅读(264) 评论(0) 推荐(0)
摘要:翻译:集合已修改;枚举操作可能无法执行 foreach(var item in selectedNode.Childrens) { if(item.ProjectItem.FileName == fileName) { item.RemoveNode(); } } 错误原因 通常,.Net集合不支持 阅读全文
posted @ 2022-07-01 16:38 羽小兮 阅读(1156) 评论(0) 推荐(0)