摘要: 作为一名非主修C#的程序员,在此记录下学习与工作中C#的有用内容,持续更新 对类型进行约束,class指定了类型必须是引用类型,new()指定了类型必须具有一个无参的构造函数,规定T类型必须实现IUser,规定T必须为struct where T : class, new(), T:IUser, T 阅读全文
posted @ 2017-04-22 19:45 Hey,Coder! 阅读(544) 评论(0) 推荐(0)
摘要: #!/bin/bash # 简化版Docker镜像迁移脚本 # xx.sh root@127.0.0.1 xxx:latest containername set -e #if [ $# -ne 3 ]; then # echo "用法: $0 <远程主机> <镜像名> <容器名>" # echo 阅读全文
posted @ 2025-11-28 19:46 Hey,Coder! 阅读(2) 评论(0) 推荐(0)
摘要: public static T JsonDeepTo<T>(this object obj) { switch (obj) { case null: return default; case JsonElement element: var jsonStr = element.GetRawText( 阅读全文
posted @ 2025-11-25 12:42 Hey,Coder! 阅读(3) 评论(0) 推荐(0)
摘要: 原理 应用程序调用 GetSchemaTable() ↓ ADO.NET 驱动程序生成元数据查询SQL ↓ 发送到数据库服务器执行 ↓ 数据库返回结果集架构信息(不包含实际数据) ↓ ADO.NET 解析架构信息并构建 DataTable ↓ 返回包含完整列信息的 DataTable sqlsuga 阅读全文
posted @ 2025-11-21 22:06 Hey,Coder! 阅读(4) 评论(0) 推荐(0)
摘要: public static class DistinctEx { /// <summary> /// 根据指定字段去重 /// </summary> /// <typeparam name="TSource"></typeparam> /// <typeparam name="TKey"></typ 阅读全文
posted @ 2025-11-04 14:27 Hey,Coder! 阅读(7) 评论(0) 推荐(0)
摘要: private SqlSugarClient GetDB() { SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = "Host=127.0.0.1;Database=test;User 阅读全文
posted @ 2025-10-13 15:01 Hey,Coder! 阅读(30) 评论(0) 推荐(0)
摘要: 安装 docker run -dp 5000:5000 --restart=always --name oldboyedu-registry -v /var/lib/registry:/var/lib/registry registry:2 验证服务 curl http://127.0.0.1:50 阅读全文
posted @ 2025-10-09 11:44 Hey,Coder! 阅读(4) 评论(0) 推荐(0)
摘要: public static List<dynamic> OrderByKey (this IList<dynamic> list, string propertyName, bool isDescending = false) { var propertyInfo = list[0].GetType 阅读全文
posted @ 2025-09-25 13:27 Hey,Coder! 阅读(14) 评论(0) 推荐(0)
摘要: //测试类 var type = typeof(TestClass); //给类对象添加、获取特性 TypeDescriptor.AddAttributes(type, indexAttr); //var attr = TypeDescriptor.GetAttributes(type)[typeo 阅读全文
posted @ 2025-09-22 17:50 Hey,Coder! 阅读(22) 评论(0) 推荐(0)
摘要: public static class FileSafeWrite { public static void WriteAllTextAtomically(string filePath, string content) { // 定义临时文件路径 string tempFilePath = fil 阅读全文
posted @ 2025-09-22 15:05 Hey,Coder! 阅读(20) 评论(0) 推荐(1)
摘要: using System.Collections.Concurrent; internal class Program { static void Main(string[] args) { ConcurrentDictionary<string, RedisConnection> redisCon 阅读全文
posted @ 2025-09-16 18:59 Hey,Coder! 阅读(11) 评论(0) 推荐(0)