随笔分类 - c#知识点
摘要:原文链接:https://www.jb51.net/article/122143.htm 输出如下图所示: 猜测这里是由于js初始化时间的时候往往是向 1970/01/01 添加毫秒数,JavaScriptSerializer进行序列化的时候也会格式化为距离1970/01/01 到当该时间点GMT+
阅读全文
摘要:原文链接:https://learn.microsoft.com/zh-cn/dotnet/api/system.web.script.serialization.javascriptserializer?view=netframework-4.8.1&redirectedfrom=MSDN 命名空
阅读全文
摘要:原文链接:https://www.cnblogs.com/wangqilong/p/12540397.html https://www.cnblogs.com/firstyi/archive/2007/11/20/965957.html ViewState的使用比较简单,一两句话就可以了。赋值: V
阅读全文
摘要:原文链接:https://blog.csdn.net/weixin_44917045/article/details/103236167 https://blog.csdn.net/bazinga_y/article/details/134416680 在写分页的时候,返回Json数据给前台的时候,
阅读全文
摘要:第一次遇到,智能搜索中的答案: public class MyClass { public int Id { get; set; } public string Name { get; set; } } using System; using System.Collections.Generic;
阅读全文
摘要:原文链接:https://www.cnblogs.com/bincoding/p/8065437.html https://www.cnblogs.com/bruce1992/p/14022655.html 今天看代码遇到了很多await,梳理一下await的用法。 await只针对awaitabl
阅读全文
摘要:webservice 可以直接配置url TransService.DataTrans client = new SGTSC.Web.TransService.DataTrans(); client.Url = "http://..DataTrans.asmx";
阅读全文
摘要:用DBNull.Value 如:dt.Rows[0]["name"] =DBNull.Value;
阅读全文
摘要:原文链接:https://blog.csdn.net/m0_65636467/article/details/127770112 C#取随机数(Random篇) 一、整数随机数 //10以内的随机整数 Random rd= new Random(); int n = ran.Next(10); //
阅读全文
摘要:原文链接:https://learn.microsoft.com/zh-cn/dotnet/fundamentals/code-analysis/quality-rules/ca1864 Dictionary<TKey,TValue>.ContainsKey(TKey) 和 Dictionary<T
阅读全文
摘要:原文链接:https://www.cnblogs.com/zhouyunbaosujina/p/3303136.html System.DateTime的最小可能值:DateTime.MinValue.ToString()=0001-1-1 0:00:00 我们实际用的时候会指定一个默认值DateT
阅读全文
摘要:与正常的绑定是不一样的,需要用 Text='<%# Eval("zyddpj") %>'
阅读全文
摘要:https://blog.csdn.net/anxin_hw/article/details/128312846 一、错误使用场景 1、普通for循环遍历List删除指定元素,list.remove(index) 示例:将姓张的名字移除掉 List<String> nameList = new Ar
阅读全文
摘要:在C#中,可以使用内置的排序方法对数组进行排序。以下是一些常用的排序方法: 使用Array.Sort<T>方法对数组进行排序。这是一个通用方法,可以对任何类型的数组进行排序,只要类型实现了IComparable接口。 int[] array = new int[] { 3, 1, 4, 1, 5,
阅读全文
摘要:原文链接:https://www.cnblogs.com/jk-2048/p/18030587 https://blog.csdn.net/xiongyanglai/article/details/136473932 1、所属命名空间 .NET 3.5在 System.Collections.Gen
阅读全文
摘要:Math.Max(ans, score)
阅读全文
摘要:string str = "Hello, World!"; char character = str[6]; // 取索引为6的字符,结果为'W' Console.WriteLine(character); // 输出: W string s = "011101";s[i] == '0';//i为字
阅读全文
摘要:#定义矩阵有多种方法,以下是几种常见的实现方式: 二维数组:使用C#的二维数组来表示矩阵。可以使用int[,]类型来定义一个整数矩阵,如: int[,] matrix = new int[3, 3] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; Jagged数组:使用C#的
阅读全文
摘要:一直以为split是用来分隔字符的,没想到还可以分隔数组。让程序变得更简单。微软官网的介绍在此记录下。 https://learn.microsoft.com/zh-cn/dotnet/csharp/how-to/parse-strings-using-split 1、分单个字符 string ph
阅读全文
摘要:datetable调用函数,一般可以在数据库里加函数。因为c#已经写好了,再转过去比较耗时间,也不一定能转过去,所以用了这种方法:先查出datetable,用参数直接调用c#方法。 Func<int, int> customMethod = x => x * x; foreach (DataRow
阅读全文