Learn: int structure and its strategies in C#.Net, it’s a predefined structure of .Net system; here we will examine its techniques and properties with example.
int is a pre-characterized structure of .NET system class library. What’s more, as we realize that each structure in the .NET system contains a few techniques and properties to work on it.
There are the following significant strategies for int structure:
- int.Equals()
- int.Parse()
- int.MaxValue
- int.MinValue
1) int.Equals()
This strategy is utilized to check two given int object are equivalent or not. It returns a boolean outcome.
2) int.Parse()
This strategy is utilized to change over or parse the string to int.
3) int.MaxValue
This is a get property of int structure. It returns the greatest conceivable estimation of an int variable.
4) int.MinValue
This is a get property of int structure. It returns the greatest conceivable estimation of an int variable.
All the above technique can undoubtedly comprehend with the assistance of the program:
Above program produce the following outcome:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
bool flag = false;
int val;
val = int.Parse("12345");
Console.WriteLine("Value is : "+val);
flag = int.Equals(123345, 123347);
if(flag == true)
Console.WriteLine("Both are equal");
else
Console.WriteLine("Both are not equal");
Console.WriteLine("MaxValue of int : " + int.MaxValue);
Console.WriteLine("MinValue of int : " + int.MinValue);
}
}
}
Output:
Value is : 125
Both are not equal
MaxValue of byte : 2147483647
MinValue of byte : -2147483648