C# 正则表达式(2)
// pattan = @"[^ahou]"; 表示匹配除ahou之外的字符,^在表示反义
string res4 = Regex.Replace(s, @"[^ahou]", "*");
Console.WriteLine(res4);
res3 = Regex.IsMatch(s, @"^d{5,12}$"); //表示匹配是否是5-12位之间的数字// pattan = @"[^ahou]"; 表示匹配除ahou之外的字符,^在表示反义
string res4 = Regex.Replace(s, @"[^ahou]", "*");
Console.WriteLine(res4);
res3 = Regex.IsMatch(s, @"^d{5,12}$"); //表示匹配是否是5-12位之间的数字例子来源于此视频https://www.bilibili.com/video/av1422127?p=4 此例子是想说明有的类主要使用它的事件namespace Wpf_test { /// <summary> &...
事件的拥有者同时是事件的响应者using System; using System.Windows.Forms; /// <summary> /// 事件的拥有者同时是事件的响应者 /// </summary> na...
简单用法,一句一句来,便于理解 Func<int, int, int> func = new Func<int, int, int>((int a, int b) => { return a * b; });(int a, int b) => { ret...
使用Stopwatch类进行运行时间的监测要使用 System.Diagnostics 命名空间方法表 4Reset()停止时间间隔测量,并将运行时间重置为零。Restart()停止时间间隔测量,将运行时间重置为零,然后开始测量运行时间。Start()开始或继续测量某个时间间隔的运行时间。...
Directory类:静态类,主要处理文件目录。方法:CreateDirectory(String)在指定路径中创建所有目录和子目录,除非它们已经存在。返回值是一个DirectoryInfo对象Delete(String)从指定路径删除空目录。无返回值。Exists(String)确定给定路径是否引...
今天突然想C#中,用数组中的Max()方法和直接通过比较获取最大值的时间谁快,于是试了试: static void Main(string[] args) &nb...