摘要: OpenFileDialogprivate FileStream OpenFile(){ // Displays an OpenFileDialog and shows the read/only files. OpenFileDialog dlgOpenFile = new OpenFileDialog(); dlgOpenFile.ShowReadOnly = true; if(dlgOpenFile.ShowDialog() == DialogResult.OK) { // If ReadOnlyChecked is true, uses the OpenFile method to / 阅读全文
posted @ 2013-04-25 20:56 Predator 阅读(158) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Dynamic;namespace ConsoleApplication1{ class Program { private static T1 Add<T1,T2>(T1 a,T2 b) { dynamic m = a; dynamic n = b; return (dynamic)(m + n); } static void Main(string[] args) { //string[] 阅读全文
posted @ 2013-04-25 20:55 Predator 阅读(131) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Dynamic;namespace ConsoleApplication1{ class Program { private static T1 Add<T1,T2>(T1 a,T2 b) { dynamic m = a; dynamic n = b; return (dynamic)(m + n); } static void Main(string[] args) { //string[] 阅读全文
posted @ 2013-04-25 20:46 Predator 阅读(130) 评论(0) 推荐(0) 编辑
摘要: /字符串格式化,自动化属性赋值using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { //string[] names = { "ganquanfu", "ligang", "zhongshi" }; //var res = names.Where(name => 阅读全文
posted @ 2013-04-25 20:45 Predator 阅读(182) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading;namespace ConPra{ class Program { //主线程结束之后,所有的子线程都结束 public static void Main(string[] Args) { Thread t1; Thread t2; t1 = new Thread(new ThreadStart(PrintfAllDatasThrea 阅读全文
posted @ 2013-04-25 20:44 Predator 阅读(450) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;namespace ConPra{ class Program { public static void Main(string[] Args) { string name = "asfafasfasf fasf"; char n = name[0]; Console.WriteLine("获取的字符为:" + n);//输出a strin 阅读全文
posted @ 2013-04-25 20:43 Predator 阅读(260) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;namespace ConPra{ class Program { public static void Main(string[] Args) { List<string> names = new List<string>(); names.Add("ganquanfu1"); names.Add("ligang2" 阅读全文
posted @ 2013-04-25 20:39 Predator 阅读(1797) 评论(0) 推荐(0) 编辑
摘要: usingSystem;usingSystem.Linq;namespaceConTest{classProgram{staticvoidPrint(stringtext,intoffset){ varmatrix=text .Select((c,i)=>new{Char=c,Index=i}) .GroupBy(c=>c.Index%offset,c=>c.Char.ToString()); Array.ForEach( matrix.ToArray(), a=>Console.WriteLine(String.Join("|",a.Reverse 阅读全文
posted @ 2013-04-25 20:12 Predator 阅读(470) 评论(0) 推荐(0) 编辑
摘要: //Linq的写法usingSystem;usingSystem.Linq;namespaceConTest{classProgram{staticvoidMain(string[]args){Console.WriteLine("请输入字符串:");stringinput=Console.ReadLine();varresult=fromcininputgroupcbycintogselectg;foreach(vartinresult){Console.WriteLine("{0},{1}",t.Key,t.Count());}Console.Rea 阅读全文
posted @ 2013-04-25 19:33 Predator 阅读(287) 评论(0) 推荐(0) 编辑