
.netC#
小晖Allen
这个作者很懒,什么都没留下…
展开
-
使用C#获取Windows版本(源码)
using System;using System.Runtime.InteropServices;namespace GetWindowsVersion{[ StructLayout( LayoutKind.Sequential )]public class OSVersionInfo { public int OSVersionInfoSize; public int Ma转载 2006-09-03 15:54:00 · 2358 阅读 · 0 评论 -
一个简单的浏览器
添加引用在工具箱中添加 private void button1_Click(object sender, System.EventArgs e) { object Zero = 0; object EmptyString = ""; string local=this.textBox1.Text; axWebBrowser1.Navigate(local,ref Zero,原创 2006-07-30 17:01:00 · 913 阅读 · 0 评论 -
体验Windows Forms
在窗体中创建一个新窗体新建一个框体,将IsMdiContainer属性设置为TrueMainMenuStrip属性与ContextmenuStrip控件相关联 private void newToolStripMenuItem1_Click(object sender, EventArgs e) { Form2 frm = new Form2();原创 2006-07-15 17:01:00 · 871 阅读 · 0 评论 -
C#入门(7)-委托
委托的简单用法using System;namespace Example.Dele{ class Operations { public static double MulTwo(double value) { return value * 2; } public static double Square(double value) { return value * v原创 2006-07-08 12:59:00 · 969 阅读 · 0 评论 -
C#入门(3) 类型转换的方法
演示C#中类型转换的方法using System;class TypeTrans{ public static void Main( ) { //隐式转换,int到long 和 float到double Console.WriteLine("隐式转换:"); int iValue = int.MaxValue; long lValue = iValue; //转换成功 Console.原创 2006-07-07 18:14:00 · 1050 阅读 · 0 评论 -
C#入门(9)两个排序算法
冒泡排序算法using System;public class BubbleSort{ //冒泡排序处理算法 public void Sort( int [] list ) { int i = 0; int j = 1; bool inOrder = false; while( ( j { //若for循环后没有改变,则表明序列已经有序 inOrder = true;原创 2006-07-08 13:33:00 · 909 阅读 · 0 评论 -
C#入门(8)-实现单链表
实现单链表using System;using System.IO;// 构成链表的结点定义 public class Node { public Object data; public Node next; public Node( Object d ) { data = d; next = null; }}public class List { // 用变量来实现表头 private原创 2006-07-08 13:32:00 · 904 阅读 · 0 评论 -
C#入门(6)重载
重载 using System;class Vector{ private double XVector; private double YVector; //构造函数 public Vector(double x, double y ) { XVector = x; YVector = y; } //获取向量的长度 public double GetLength( ) { double L原创 2006-07-08 12:57:00 · 1028 阅读 · 0 评论 -
C#入门(5)枚举和结构类型
通过个人电话本演示枚举类型与结构类型的用法--枚举和结构类型using System;class ID{ //定义枚举类型 public enum Sex { male, female }; //注意别忘了这里的分号 //定义电话本的结构类型 public struct TelBook { public string name; public Sex sex; //性原创 2006-07-07 18:20:00 · 1202 阅读 · 0 评论 -
C#入门(4)数组
利用各种循环语句计算整数10的阶乘--循环语句using System;class Loop{ //利用for循环计算n的阶乘 public static long UseFor ( int n ) { long sum = 1; for ( int i = 1; i sum = sum * i; return sum; } //利用while循环计算n的阶乘 public sta原创 2006-07-07 18:17:00 · 1445 阅读 · 0 评论 -
C#入门(2)简单预定义数据类型
演示命令行参数和标准输入流的使用using System;class input{ public static void Main(String[] args) { string strName1; //声明一个string类型的变量 strName1 = args[0]; //把第一个参数赋给变量strName1 Console.WriteLine("Hi " + strName1);原创 2006-07-07 18:12:00 · 1124 阅读 · 0 评论 -
C#(1)经典入门
一个经典入门程序 using System; //引用一个叫System的名空间class HelloCsharp //定义类HelloCsharp{ static void Main( ) //静态的Main方法是程序的入口 { System.Console.WriteLine("Hello world !"); //输出 }}原创 2006-07-07 18:10:00 · 904 阅读 · 0 评论 -
关于线程
using System;using System.Threading;//Thead的使用namespace ThreadingExample1{ public class ThreadExample { public static void ThreadProc() { for(int i=0;i { Console.WriteLine("ThreadProc:{0}",i)原创 2006-08-09 15:40:00 · 1169 阅读 · 0 评论