Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

ฟิลด์ Byte.MaxValue ใน C#

ฟิลด์ Byte.MaxValue ใน C# ใช้แทนค่าที่มากที่สุดที่เป็นไปได้ของ Byte (คือ 255)

ไวยากรณ์

ไวยากรณ์มีดังนี้:

public const byte MaxValue = 255;

ตัวอย่าง

ตัวอย่างการใช้งานฟิลด์ Byte.MaxValue:

using System; 
public class Demo { 
    public static void Main(){ 
        byte val; 
        val = Byte.MaxValue; 
        Console.WriteLine("Maximum Value (Byte) = " + val); 
    } 
}

ผลลัพธ์

โค้ดจะแสดงผลดังนี้:

Maximum Value (Byte) = 255