C# | SByte Struct Fields Last Updated : 02 May, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report In C#, Sbyte Struct comes under the System namespace which represents an 8-bit signed integer. The SByte value type represents integers with values ranging from -128 to +127. There are the two fields in the System.SByte Struct as follows: SByte.MaxValue Field SByte.MinValue Field SByte.MaxValue Field This is a constant field which represents the largest possible value(127) of SByte. Syntax: public const sbyte MaxValue = 127; Example: CSharp // C# program to demonstrate the SByte.MaxValue // Field by checking whether the given +ve long // value can be converted to sbyte value or not using System; class Max_Geeks { // Main method static public void Main() { // Only taking +ve values long lValue = 128; sbyte sbValue; // Using the MaxValue Field to check // whether the conversion is Possible // or not for +ve values only if (lValue <= sbyte.MaxValue) { // Type conversion from long to sbyte sbValue = (sbyte)lValue; Console.WriteLine("Converted long integer value to {0}.", sbValue); } else { Console.WriteLine("Conversion is not Possible"); } } } Output: Conversion is not Possible SByte.MinValue Field This is a constant field which represents the smallest possible value(-128) of SByte. Syntax: public const sbyte MinValue = -128; Example: CSharp // C# program to demonstrate the SByte.Min Value // Field by checking whether the given -ve long // value can be converted to sbyte value or not using System; class Min_Geeks { // Main method static public void Main() { // Only taking -ve values long lValue = -128; sbyte sbValue; // Using the MinValue Field to check // whether the conversion is Possible // or not for -ve values only if (lValue >= sbyte.MinValue) { // Type conversion from long to sbyte sbValue = (sbyte)lValue; Console.WriteLine("Converted long integer value to {0}", sbValue); } else { Console.WriteLine("Conversion is not Possible"); } } } Output: Converted long integer value to -128 References: https://docs.microsoft.com/en-us/dotnet/api/system.sbyte.maxvalue?view=netframework-4.7.2 https://docs.microsoft.com/en-us/dotnet/api/system.sbyte.minvalue?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | SByte Struct Fields K Kirti_Mangal Follow Improve Article Tags : Misc C# CSharp-SByte-Struct Practice Tags : Misc Similar Reads Ruby | Struct Class Struct is a compact way to group together a number of attributes, using accessor methods, without creating an explicit class. The Struct class is a creator of specific classes, each one is defined to hold a set of variable and their accessors. The subclass of Struct class is Struct::Tms. Example: Ru 5 min read Structures in C++ C++ Structures are used to create user defined data types which are used to store group of items of different data types.SyntaxBefore using structure, we have to first define the structure using the struct keyword as shown:C++struct name{ type1 mem1; type2 mem2; ... };where structure name is name an 8 min read C# | Structures | Set - 1 Structure is a value type and a collection of variables of different data types under a single unit. It is almost similar to a class because both are user-defined data types and both hold a bunch of different data types. C# provide the ability to use pre-defined data types. However, sometimes the us 4 min read Flexible Array Members in a structure in C Flexible Array Member(FAM) is a feature introduced in the C99 standard of the C programming language.For the structures in C programming language from C99 standard onwards, we can declare an array without a dimension and whose size is flexible in nature.Such an array inside the structure should pref 4 min read What is data type of FILE in C ? Prerequisite : Basics of File Handling In C language, while file handling is done a word FILE is used. What is FILE? Example FILE *fp1, *fp2; While doing file handling we often use FILE for declaring the pointer in order to point to the file we want to read from or to write on. As we are declaring t 3 min read Like