C#
共 3 篇文章
C#函数参数传递 ref关键字
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Swap(ref int x,ref int y) { int temp = x; x = y; y = temp; } static void Main(string[] args) { int a = 40; int b = 80; Console.WriteLine("交换前: a = {0},b …
2013-01-01 21:39 · C#
C#枚举类型
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { enum WeekDays { Sunday, Monday, Tuesday, Wednesday, Thuresday, Friday, Saturday } class Program { static void Main(string[] args) { WeekDays today; for (today = WeekDays.Sunday; tod…
2013-01-01 19:32 · C#
C#基本的正则表达式操作
[实例4-14]本例将创建一个控制台应用程序,使用正则表达式判断电话号码是否为北京地区的电话号码。首先北京地区电话区号为"010",后面电话号码位数为8,例如:"01088888888"。使用正则表达式的语法规则可进行限定,在控制台项目Program.cs文件的main函数中输入下面代码: 书中的源代码是这样写的: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace Consol…
2012-12-30 14:31 · C#