随笔分类 -  C#

摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Roading001{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void pictureBox1_Paint(object send 阅读全文
posted @ 2010-01-21 20:17 robin.won 阅读(527) 评论(1) 推荐(0)
摘要://编译时常量public const int constValue=100;//运行时常量public static readonly int readonlyValue=200;代码将被编译成MSIL(微软中间语言),在MSIL中,constValue直接被100所替换,且以后不会再更改;readonlyValue则只是变成对其变量的引用,其值在以后还可以改变。所以一般选择readonly变量,这样比较灵活;但是诸如PI等于3.1415926这种一百年不变的变量,可以使用const。——摘自《Effective C#》 阅读全文
posted @ 2010-01-21 20:05 robin.won 阅读(195) 评论(0) 推荐(0)
摘要:double a=2;double b=Math.Pow(a,3);可得b=8专有的平方根函数Math.Sqrt(a)也可由Math.Pow(a,0.5)代替。 阅读全文
posted @ 2010-01-21 19:35 robin.won 阅读(1963) 评论(0) 推荐(0)