05 2022 档案
文件属性读取C#
摘要:using System.IO;//先添加命名空间 static void Main(string[] args) { string fle = @"D:\123\123.txt"; FileInfo fileInfo = new FileInfo(fle); Console.WriteLine("
阅读全文
文件的创建 C#
摘要:namespace 文件的创建 { class Program { static void Main(string[] args) { string path = @"C:\"; if (!File.Exists(path + "ww.txt")) { FileStream fs = File.Cr
阅读全文
判断某文件是否存在 C#
摘要:namespace 判断某文件是否存在 { class Program { static void Main(string[] args) { string path = "C:\\tt.jpg"; bool ph= File.Exists(path);//判断是否有这个文件 if (ph) { C
阅读全文
泛型继承之普通类继承泛型类C#
摘要:using System; namespace 泛型继承之普通类继承泛型类 { abstract class genClass<T> { protected T field; public virtual T property { set { field=value; } } public genC
阅读全文
索引器在接口中的使用 C#
摘要:namespace 索引器在接口中使用 { public interface Ifindex//定义一个接口 { int this[int index]//声明索引 { get; set; } } public class TestIndex:Ifindex//继承接口 { int[] myint
阅读全文
C# set 与get 的一般应用
摘要:namespace 属性Set与Get { class Program { static void Main(string[] args) { EmployeeInformation emp = new EmployeeInformation();//创建对象 //以下是对字段的一般性赋值: emp
阅读全文
C#迭代的一般应用
摘要:using System.Collections;//必须添加的命名空间 namespace 迭代的一般应用 { class Program { static void Main(string[] args) { IterationMonths im = new IterationMonths();
阅读全文
C# HashTable添加键和值
摘要:static void Main(string[] args) { Hashtable ht = new Hashtable();//实例化对象 ht.Add("a","张三");//添加键和值 ht.Add("b", "李四"); ht.Add("c", "王五"); ht.Add("d", "赵
阅读全文
C# 正则表达式判断 电话号格式与字符替换
摘要:static void Main(string[] args) { string _reguler = @"^(0755|0755-)\d{7,8}$";//正则表达式判断电话格式输入是否确 string[] TextPhone = { "0755-8978456", "07551235897",
阅读全文
正则表达式 - 简介
摘要:正则表达式 - 简介 除非您以前使用过正则表达式,否则您可能不熟悉一些术语。但是,毫无疑问,您已经使用过不涉及脚本的某些正则表达式概念。 例如,您很可能使用 ? 和 * 通配符来查找硬盘上的文件。? 通配符匹配文件名中的 0 个或 1 个字符,而 * 通配符匹配零个或多个字符。像 data(\w)?
阅读全文