随笔分类 -  c#知识点

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页
摘要:https://blog.csdn.net/anxin_hw/article/details/128312846 一、错误使用场景 1、普通for循环遍历List删除指定元素,list.remove(index) 示例:将姓张的名字移除掉 List<String> nameList = new Ar 阅读全文
posted @ 2024-05-04 21:45 yinghualeihenmei 阅读(1733) 评论(0) 推荐(0)
摘要:在C#中,可以使用内置的排序方法对数组进行排序。以下是一些常用的排序方法: 使用Array.Sort<T>方法对数组进行排序。这是一个通用方法,可以对任何类型的数组进行排序,只要类型实现了IComparable接口。 int[] array = new int[] { 3, 1, 4, 1, 5, 阅读全文
posted @ 2024-05-03 01:03 yinghualeihenmei 阅读(200) 评论(0) 推荐(0)
摘要:原文链接:https://www.cnblogs.com/jk-2048/p/18030587 https://blog.csdn.net/xiongyanglai/article/details/136473932 1、所属命名空间 .NET 3.5在 System.Collections.Gen 阅读全文
posted @ 2024-05-02 23:57 yinghualeihenmei 阅读(1765) 评论(0) 推荐(0)
摘要:Math.Max(ans, score) 阅读全文
posted @ 2024-05-01 19:04 yinghualeihenmei 阅读(43) 评论(0) 推荐(0)
摘要:string str = "Hello, World!"; char character = str[6]; // 取索引为6的字符,结果为'W' Console.WriteLine(character); // 输出: W string s = "011101";s[i] == '0';//i为字 阅读全文
posted @ 2024-05-01 19:02 yinghualeihenmei 阅读(267) 评论(0) 推荐(0)
摘要:#定义矩阵有多种方法,以下是几种常见的实现方式: 二维数组:使用C#的二维数组来表示矩阵。可以使用int[,]类型来定义一个整数矩阵,如: int[,] matrix = new int[3, 3] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; Jagged数组:使用C#的 阅读全文
posted @ 2024-04-30 15:32 yinghualeihenmei 阅读(407) 评论(0) 推荐(0)
摘要:一直以为split是用来分隔字符的,没想到还可以分隔数组。让程序变得更简单。微软官网的介绍在此记录下。 https://learn.microsoft.com/zh-cn/dotnet/csharp/how-to/parse-strings-using-split 1、分单个字符 string ph 阅读全文
posted @ 2024-04-26 17:13 yinghualeihenmei 阅读(162) 评论(0) 推荐(0)
摘要:datetable调用函数,一般可以在数据库里加函数。因为c#已经写好了,再转过去比较耗时间,也不一定能转过去,所以用了这种方法:先查出datetable,用参数直接调用c#方法。 Func<int, int> customMethod = x => x * x; foreach (DataRow 阅读全文
posted @ 2024-04-25 18:02 yinghualeihenmei 阅读(25) 评论(0) 推荐(0)
摘要:C#中截取字符串某个字符之前的字符,可以通过以下几种实现方法: 1、使用 Substring 方法:可以使用字符串的 Substring 方法根据指定字符的位置来截取字符串。例如,假设要截取字符串中第一个等号之前的字符,代码如下: string str = "Hello=World"; int in 阅读全文
posted @ 2024-04-23 14:41 yinghualeihenmei 阅读(4122) 评论(0) 推荐(1)
摘要:数根又称数字根,是自然数的一种性质,每个自然数都有一个数根。对于给定的自然数,反复将各个位上的数字相加,直到结果为一位数,则该一位数即为原自然数的数根。 代码: public class Solution { public int AddDigits(int num) { while (num >= 阅读全文
posted @ 2024-04-17 21:34 yinghualeihenmei 阅读(51) 评论(0) 推荐(0)
摘要:在C#中,可以使用string类的ToUpper()和ToLower()方法来实现大小写的转换。 阅读全文
posted @ 2024-04-17 21:21 yinghualeihenmei 阅读(21) 评论(0) 推荐(0)
摘要:c#求绝对值在C#中,可以使用以下不同的方法来求绝对值: 方法一:使用Math.Abs()函数 int num = -10;int absValue = Math.Abs(num);Console.WriteLine(absValue); // 输出:10方法二:使用条件表达式 int num = 阅读全文
posted @ 2024-04-17 21:08 yinghualeihenmei 阅读(1691) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/weixin_45313952/article/details/114875545 b ? x : y ① 单个使用例: public static void main(String[] args) { int a = 2; int b = 3; 阅读全文
posted @ 2024-04-17 00:34 yinghualeihenmei 阅读(38) 评论(0) 推荐(0)
摘要:return new double[]{celsius+ 273.15,celsius * 1.80 + 32.00}; 阅读全文
posted @ 2024-04-17 00:22 yinghualeihenmei 阅读(19) 评论(0) 推荐(0)
摘要:原文链接:https://zhuanlan.zhihu.com/p/558000060?utm_id=0 1、流的含义: 流可以视为一组连续的一维数据,包含开头和结尾,并且其中的游标指示了流的当前位置。抽象基类 Stream支持读取和写入字节。 2、流涉及三个基本操作: 读取 :将数据从流传输到数据 阅读全文
posted @ 2024-04-10 11:45 yinghualeihenmei 阅读(842) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/nutian/article/details/2913670 https://blog.csdn.net/m0_58015531/article/details/131322801 WebClient类 如果只想从特定的URI请求文件,则可以使用 阅读全文
posted @ 2024-04-10 10:57 yinghualeihenmei 阅读(795) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/weixin_45763353/article/details/118005453 Button是按钮控件,具有按钮所有的属性和事件方法,在客户端被渲染为表单元素提交按钮。 Linkbutton是链接按钮,用于创建超链接样式的按钮。该控件的外观与 阅读全文
posted @ 2024-04-07 11:38 yinghualeihenmei 阅读(106) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/jk007/article/details/30251963 using ICSharpCode.SharpZipLib.Zip; public static void CompressDirectory(string iDirectory, s 阅读全文
posted @ 2024-04-07 10:56 yinghualeihenmei 阅读(41) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/weixin_45023644/article/details/121951840 C#的文件操作的功能是非常丰富的。他们大多来自System.IO类,比如:File、Directory、BinaryReader、BinaryWriter、Dir 阅读全文
posted @ 2024-04-07 10:24 yinghualeihenmei 阅读(245) 评论(0) 推荐(0)
摘要:原文链接:https://blog.csdn.net/qq_35970739/article/details/82887314 C#中Directory.GetFiles(string path , string searchPattern, SearchOption searchOption ) 阅读全文
posted @ 2024-04-03 14:57 yinghualeihenmei 阅读(5528) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页