เมธอด GetLowerBound() ของคลาสอาร์เรย์ใน C# รับขอบล่างของมิติที่ระบุในอาร์เรย์
ขั้นแรก ตั้งค่าอาร์เรย์และรับขอบเขตล่างดังที่แสดงด้านล่าง -
arr.GetLowerBound(0).ToString()
ต่อไปนี้เป็นตัวอย่างที่ระบุการใช้งานเมธอด GetLowerBound() ใน C#
ตัวอย่าง
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace lower {
class Program {
static void Main(string[] args) {
Array arr = Array.CreateInstance(typeof(String), 3);
arr.SetValue("Car", 0);
arr.SetValue("Truck", 1);
arr.SetValue("Motorbike", 2);
Console.WriteLine("Lower Bound {0}",arr.GetLowerBound(0).ToString());
Console.ReadLine();
}
}
} ผลลัพธ์
Lower Bound 0