随笔分类 -  C#

.Net Core Hangfire 运行时间偏差问题
摘要:实际运行和设置的运行时间偏差八小时 AddOrUpdate中的默认是UTC时间,需要手动设置为Local ![](https://img2023.cnblogs.com/blog/2922453/202305/2922453-20230530104231710-1482449375.png) `Re 阅读全文

posted @ 2023-05-30 10:46 糯米白白 阅读(411) 评论(0) 推荐(0)

C# 该行已经属于另一个表。
摘要:`table.Rows.Add(dr);` 改为 `table.Rows.Add(dr.ItemArray);` 阅读全文

posted @ 2023-05-29 14:02 糯米白白 阅读(142) 评论(0) 推荐(0)

水晶报表 加载报错 An error has occurred while attempting to load the Crystal Reports runtime
摘要:源错误: Crystal Reports An error has occurred while attempting to load the Crystal Reports runtime. Either the Crystal Reports registry key permissions a 阅读全文

posted @ 2023-05-18 10:18 糯米白白 阅读(125) 评论(0) 推荐(0)

水晶报表导出中文字符乱码
摘要:在ASP.Net开发的页面上嵌入的水晶报表,中文字符和英文字符均能正确显示 但是导出为PDF后发现中文字符乱码了 所有的字体都是“Arial” 解决办法: 针对中文显示的字段或者参数,采用中文字体,比如“宋体”即可解决 为了好看并且兼容,索性将所有的字体都改为“宋体”,否则部分为“宋体”,部分为别的 阅读全文

posted @ 2023-05-11 18:27 糯米白白 阅读(88) 评论(0) 推荐(0)

C# .Net Core 合并PDF文件
摘要:使用 PdfSharpCore nuget包 代码实现 using Microsoft.AspNetCore.Razor.TagHelpers; using PdfSharpCore.Pdf; using PdfSharpCore.Pdf.IO; using System; using System 阅读全文

posted @ 2023-05-10 10:34 糯米白白 阅读(635) 评论(0) 推荐(0)

C# PDFSharp No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
摘要:在.Net Core框架使用PdfSharp插件时出现问题 需要装Core版的PdfSharp PdfSharpCore 阅读全文

posted @ 2023-05-10 10:28 糯米白白 阅读(540) 评论(0) 推荐(0)

C# 中判断字符是否大写
摘要:在C#中,通常判断一个字符是否为大写字母,有些人可能会第一时间想到用正则表达式,那除了正则表达式,是否还有其他方式呢? 答案是肯定的,先一睹为快,具体代码如下: using System; using System.Collections.Generic; using System.Linq; us 阅读全文

posted @ 2023-04-21 09:53 糯米白白 阅读(284) 评论(0) 推荐(0)

VS中添加自定义代码片段
摘要:https://www.cnblogs.com/yuehouse/p/9892705.html 阅读全文

posted @ 2023-04-20 14:14 糯米白白 阅读(17) 评论(0) 推荐(0)

C# 获取泛型的名称
摘要:``` // 获取类型名称 public void GetClassName() { // 打印结果:ClassName Console.WriteLine(typeof(T).Name); } // 获取类型完全名称 public void GetClassAllName() { // 打印结果: 阅读全文

posted @ 2023-04-19 14:27 糯米白白 阅读(72) 评论(0) 推荐(0)

C# DataTable 操作汇总
摘要:一、某一列求和 1. 列为数字类型 `double total= Convert.ToDouble(datatable.Compute("SUM(需要求和的参数)", ""));` 2.列为string 类型 先转为数字类型 再求和 (遇到是采用了这个方法) 会报错,加using System.Li 阅读全文

posted @ 2023-03-31 16:59 糯米白白 阅读(1938) 评论(0) 推荐(0)

Uncaught ReferenceError: bobj is not defined
摘要:创建好的水晶报表,报表没有生成。 查看html代码,数据库的数据已经获取... 按F12:出现如标题错误。 看到此异常,想起来,是因为做少了一件事,即是需要把: C:\inetpub\wwwroot\ 的aspnet_client目录,完整拷贝至项目之下。 原文链接:https://www.cnbl 阅读全文

posted @ 2023-03-29 18:43 糯米白白 阅读(36) 评论(0) 推荐(0)

.NetCore 中HangFire的使用
摘要:https://www.cnblogs.com/for-easy-fast/p/14512594.html 阅读全文

posted @ 2023-02-17 14:54 糯米白白 阅读(47) 评论(0) 推荐(0)

C# StringComparison如何使用
摘要:https://blog.csdn.net/m1234567q/article/details/52190201 阅读全文

posted @ 2023-02-07 10:01 糯米白白 阅读(21) 评论(0) 推荐(0)

C# Linq 中使用 group
摘要:https://www.cnblogs.com/cncc/p/9846390.html 阅读全文

posted @ 2023-02-06 10:08 糯米白白 阅读(27) 评论(0) 推荐(0)

C# List间的交集并集差集
摘要:一、简单类型List的交集并集差集 1、先定义两个简单类型的List List<int> listA = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8 }; List<int> listB = new List<int>() { 1, 2, 3, 4, 9 }; 阅读全文

posted @ 2023-01-11 14:05 糯米白白 阅读(7396) 评论(0) 推荐(3)

C# null和Any()检查的快捷方式
摘要:在C#6中 if (x.Items?.Any() == true) 也可以写自己的扩展方法: public static bool NotNullOrEmpty<T>(this IEnumerable<T> source) { return source != null && source.Any( 阅读全文

posted @ 2023-01-10 11:31 糯米白白 阅读(188) 评论(0) 推荐(0)

C# 解决“请求被中止: 未能创建 SSL/TLS 安全通道”的问题
摘要:解决办法:让客户端启用该协议。具体就是在发起网络请求之前确保ServicePointManager.SecurityProtocol中含有服务端所用的安全协议,如果不知道或希望客户端健壮一点,当然最简单的方式就是把所有可用的协议都启用,随你服务端将来怎么换。代码如下: ServicePointMan 阅读全文

posted @ 2022-12-15 16:39 糯米白白 阅读(2145) 评论(0) 推荐(0)

C# ASCII码字符转换
摘要:C#单纯的字母数字ASCII码转换 字母转换成数字 byte[] array = new byte[1]; //定义一组数组array array = System.Text.Encoding.ASCII.GetBytes("string"); //string为待转换的字母 int asciico 阅读全文

posted @ 2022-12-15 10:37 糯米白白 阅读(3427) 评论(0) 推荐(0)

C# ToDictionary方法
摘要:ToDictionary方法是C#中的扩展方法,可将集合转换为Dictionary。 首先,创建一个字符串数组 string[] str = new string[] {"Car", "Bus", "Bicycle"}; 现在,使用Dictionary方法将集合转换为Dictionary str.T 阅读全文

posted @ 2022-12-02 11:03 糯米白白 阅读(6278) 评论(0) 推荐(2)

C# 保留小数点后面两位方法
摘要:1、num.ToString("#0.00"); //点后面几个0就保留几位 double num=0.121245;string result=num.ToString("#0.00"); //点后面几个0就保留几位Console.WriteLine(result)。 2、num.ToString 阅读全文

posted @ 2022-11-30 10:17 糯米白白 阅读(6156) 评论(1) 推荐(0)

导航