摘要:
阅读全文
posted @ 2011-04-18 06:43
编程中国
阅读(90)
评论(0)
推荐(0)
摘要:
static void Main() { var a = new[] { 1, 10, 100, 1000 }; // int[] var b = new[] { "hello", null, "world" }; // string[] // single-dimension jagged array var c = new[] { new[]{1,2,3,4}, new[]{5,6,7,8} }; // jagged array of strings var d = new[] { new[]{"Luca", "Mads 阅读全文
posted @ 2011-04-16 11:00
编程中国
阅读(143)
评论(0)
推荐(0)
摘要:
将值类型转换为引用类型的过程称为装箱。装箱某个变量,就是创建一个引用变量,它指向堆上的新副本。引用变量是一个对象,因此,它可以使用每个对象都继承的所有方法(例如 ToString())。下面的代码进行了具体的说明:int i = 67; // i is a value typeobject o = i; // i is boxedSystem.Console.WriteLine(i.ToString()); // i is boxed在使用旨在用于对象的类时将会遇到取消装箱:例如,使用 ArrayList 存储整数。将某个整数存储在 ArrayList 中,即是对整数进行装箱。检索某个整数时, 阅读全文
posted @ 2011-04-16 10:58
编程中国
阅读(220)
评论(0)
推荐(0)
摘要:
// Set the search string: string myString = "Isabella"; // Search starting from index -1: int index = listBox1.FindString(myString, -1); if (index != -1) { // Select the found item: listBox1.SetSelected(index, true); // Send a success message: MessageBox.Show("Found the item \"&q 阅读全文
posted @ 2011-04-16 10:56
编程中国
阅读(578)
评论(0)
推荐(0)
摘要:
Form2:Form1 mainForm; public Form2(Form1 mainForm) { this.mainForm = mainForm; InitializeComponent(); }private void button1_Click(object sender, EventArgs e) { if (this.textBox1.Text != string.Empty) { mainForm.listBox1.Items.Clear(); string[] stringsEntered = textBox1.Lines; for (int count = 0; cou 阅读全文
posted @ 2011-04-16 10:55
编程中国
阅读(120)
评论(0)
推荐(0)
摘要:
string[] stringArray = new string[3]; stringArray[0] = "Yes"; stringArray[1] = "No"; stringArray[2] = "Maybe"; System.Windows.Forms.RadioButton[] radioButtons = new System.Windows.Forms.RadioButton[3]; for (int i = 0; i < 3; ++i) { radioButtons[i] = new RadioButton() 阅读全文
posted @ 2011-04-16 10:53
编程中国
阅读(119)
评论(0)
推荐(0)
摘要:
Assembly asm = Assembly.GetExecutingAssembly(); //MessageBox.Show(asm.GetName().Name); //foreach (string name in asm.GetManifestResourceNames()) //MessageBox.Show(name); Bitmap bitmap = new Bitmap(asm.GetManifestResourceStream("winform.image.jpg")); pictureBox1.Image = bitmap; 阅读全文
posted @ 2011-04-16 10:50
编程中国
阅读(130)
评论(0)
推荐(0)
摘要:
代码如下:using System.Windows.Forms;namespace WinSound{ public partial class Form1 : Form { private TextBox textBox1; private Button button1; public Form1() //constructor { InitializeComponent(); } [System.Runtime.InteropServices.DllImport("winmm.DLL", EntryPoint = "PlaySound", SetLa 阅读全文
posted @ 2011-04-16 10:41
编程中国
阅读(502)
评论(0)
推荐(0)
摘要:
string[] strArray = {"ABCDEFG", "HIJKLMNOP"};string findThisString = "JKL";int strNumber;int strIndex = 0;for (strNumber = 0; strNumber < strArray.Length; strNumber++){ strIndex = strArray[strNumber].IndexOf(findThisString); if (strIndex >= 0) break;}System.Consol 阅读全文
posted @ 2011-04-16 10:37
编程中国
阅读(436)
评论(0)
推荐(0)
摘要:
代码如下: Stream myStream = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:\\"; openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; if (op 阅读全文
posted @ 2011-04-16 10:30
编程中国
阅读(184)
评论(0)
推荐(1)
浙公网安备 33010602011771号