search c#.net

THE PRIMITIVE GAME - คนป่ามหาโหด

Search

เรื่องน่าอ่าน

|เรื่องย่อละคร มงกุฎแสงจันทร์||หาเพื่อนคุย||หางาน,เว็บหางาน||คู่มือแก้กรรมทำเองได้||เข้า Registry ไม่ได้ทำไงดี||รถยนต์มือสอง||รวมรูปบ้านและคอนโดสวย ๆ||สูตรต่างๆของการหาพื้นที่รูป 4 เหลี่ยม||สูตรมาตรฐานของ 3 เหลี่ยม||สูตรการแปลงอุณหภูมิ||ยุ้ย จีรนันท์ มะโนแจ่ม||โรคกลาก||ยาไทยทารักษาบาดแผลสด||ว่านไก่น้อย||ใบฤาษีผสมแล้ว||ต้นผักคราดหัวแหวน||ต้นและใบสดกระเม็ง||ใบบัวบก||แก้ไขภาพวิดีโอกลับหัว ตะแคงข้าง||ประวัติวันลอยกระทง||อาร์เรย์ที่ผิดปกติ ( Irregular Array) กับ Visual Basic 6.0|
|ค่าของ sin(arccos 1/2)||ตัดเสียงว่าง ๆ ออกจากไฟล์ MP3||เปลี่ยนคาราโอเกะเป็น mp3||UNESCO WARNING||A FASHION VISIONARY||ALL ABOUT ‘SEX’||Real UFO||Get Your Gear Flash Games|

SNAKE Game - Top 20 Challenge

Thursday, November 19, 2009

Array.Setvalue Method ,Console Application






// การใช้ Array.SetValue Method

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication1

{

class Program

{

public static void Main() {

// Creates and initializes a one-dimensional array.

String[] myArr1 = new String[5];

// Sets the element at index 3.

// กำหนด คำว่า three ให้ index 3

myArr1.SetValue( "three", 3 );

Console.WriteLine( "[3]: {0}", myArr1.GetValue( 3 ) );

// Creates and initializes a two-dimensional array.

String[,] myArr2 = new String[5,5];

// Sets the element at index 1,3.

// กำหนด คำว่า one-three ให้ index 1,และ index 3

myArr2.SetValue( "one-three",1,3);

Console.WriteLine( "[1,3]: {0}", myArr2.GetValue( 1, 3 ) );

// ประการศอาร์เรย์ 3 มิติ

// Creates and initializes a three-dimensional array.

String[,,] myArr3 = new String[5,5,5];

// Sets the element at index 1,2,3.

myArr3.SetValue( "one-two-three", 1, 2, 3 );

Console.WriteLine( "[1,2,3]: {0}", myArr3.GetValue( 1, 2, 3 ) );

// Creates and initializes a seven-dimensional array.

String[,,,,,,] myArr7 = new String[5,5,5,5,5,5,5];

// Sets the element at index 1,2,3,0,1,2,3.

// กำหนดสมาชิกหลายตัวให้ index พร้อมกันหลาย ตัว

int[] myIndices = new int[7] { 1, 2, 3, 0, 1, 2, 3 };

myArr7.SetValue( "one-two-three-zero-one-two-three", myIndices );

Console.WriteLine( "[1,2,3,0,1,2,3]: {0}", myArr7.GetValue( myIndices ) );

Console.ReadKey();

}

}

// ผลลัพธ์ของ โปรแกรม

/*

This code produces the following output.

[3]: three

[1,3]: one-three

[1,2,3]: one-two-three

[1,2,3,0,1,2,3]: one-two-three-zero-one-two-three

*/

}






Learn c#.net