C#
是那个太阳
大学生一枚,虚心学习
展开
-
C#语言基础六之正则表达式
正则表达式的语法和概念:正则表达式教程C#中有封装好的方法直接使用举例:待匹配字符串:“1851 1234 1950 1911 1922 00123”正则表达式:"(?<=19)\d{2}\b"预期功能:匹配跟随在”19“后面的两位数字代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;us原创 2021-04-16 16:58:22 · 78 阅读 · 0 评论 -
C#语言基础五之try-catch-finally处理异常
try:尝试执行try中的代码,如果出现异常会停止执行跳转到catch中catch:处理异常 反馈异常的问题 可以自行定义反馈’finally:无论是否出现异常都会执行finally的代码举例:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Test{ class Program.原创 2021-04-16 16:00:39 · 310 阅读 · 0 评论 -
C#语言基础四之函数
C#中的函数声明和实现一般是在类中主函数外举例说明:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Test{ class Program { //用public static 关键字修饰 //无返回值无参数 public static void Show() { Cons原创 2021-04-16 15:46:13 · 99 阅读 · 0 评论 -
C#语言基础三之数组
C#中定义数组的方法:一维数组int[] d = new int[] {1,2,3,4,5,6};int[] d = {1,2,3,4,5,6};string[] s = new string[] {"Mike", "Linda"};string[] s = {"Mike", "Linda"};二维数组int[,] a = new int[3,3]; //3行3列string[,] b = new string[2,2]; //2行2列交叉数组//数组第一行有三列,第二原创 2021-04-16 14:51:23 · 87 阅读 · 0 评论 -
C#语言基础二之循环
C#中定义数组的方法:一维数组int[] d = new int[] {1,2,3,4,5,6};int[] d = {1,2,3,4,5,6};string[] s = new string[] {"Mike", "Linda"};string[] s = {"Mike", "Linda"};二维数组int[,] a = new int[3,3]; //3行3列string[,] b = new string[2,2]; //2行2列交叉数组//数组第一行有三列,第二原创 2021-04-16 14:49:36 · 69 阅读 · 0 评论 -
C#语言基础一之Hello World
C# —— Csharp背景:微软专为.NET(.dotnet)推出的高级编程语言Unity借助Mono实现跨平台,核心是.NET Framework框架,底层还是C++C#第一个程序打印Hello World过程:.cs文件 => 编译生成.exe文件using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;原创 2021-04-16 13:57:47 · 151 阅读 · 0 评论