Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 2085 of 2646
156 Views
To change the BufferHeight of the Console, use the Console.BufferHeight property in C#.ExampleLet us now see an example −using System; class Demo { public static void Main (string[] args) { Console.BufferHeight = 200; Console.WriteLine("Buffer Height = "+Console.BufferHeight); } }OutputThis will produce the following output −Buffer Height = 200
2K+ Views
To change the background color of text in Console, use the Console.BackgroundColor Property in C#.ExampleLet us now see an example −using System; class Demo { public static void Main (string[] args) { Console.BackgroundColor = ConsoleColor.Blue; Console.WriteLine("Background color changed = "+Console.BackgroundColor); } }OutputThis will produce the following output −
120 Views
The MathF.Exp() method in C# returns the raised to the specified power.SyntaxFollowing is the syntax −public static float Exp (float val);Above, Val is the floating-point number.ExampleLet us now see an example to implement the MathF.Exp() method −using System; class Demo { public static void Main(){ float val = 90f; float res = MathF.Exp(val); Console.WriteLine("MathF.Exp() = "+res); } }OutputThis will produce the following output −MathF.Exp() = InfinityExampleLet us now see another example to implement the MathF.Exp() method −using System; class Demo { public static void Main(){ ... Read More
86 Views
The MathF.Cosh() method in C# is used to return the hyperbolic cosine of a floating-point value.SyntaxFollowing is the syntax −public static float Cosh (float val);Above, Val is the floating-point number.ExampleLet us now see an example to implement the MathF.Cosh() method −using System; class Demo { public static void Main(){ float val = 45.0f; float res = MathF.Cosh(val); Console.WriteLine("Cosh = "+res); } }OutputThis will produce the following output −Cosh = 1.746714E+19ExampleLet us now see another example to implement the MathF.Cosh() method −using System; class Demo { public static void ... Read More
145 Views
The MathF.Cos() method in C# returns the cosine of a given float value argument.SyntaxFollowing is the syntax −public static float Cos (float val);Above, Val is the floating-point value.ExampleLet us now see an example to implement the MathF.Cos() method −using System; class Demo { public static void Main(){ float val1 = 70f; float res = (val1 * (MathF.PI)) / 180; Console.WriteLine(MathF.Cos(res)); } }OutputThis will produce the following output −0.34202ExampleLet us now see another example to implement the MathF.Cos() method −using System; class Demo { public static void Main(){ ... Read More
129 Views
The Uri.IsHexDigit() method in C# determines whether a specified character is a valid hexadecimal digit.SyntaxFollowing is the syntax −public static bool IsHexDigit (char ch);Above, the parameter ch is the character to validate.ExampleLet us now see an example to implement the Uri.IsHexDigit() method −using System; public class Demo { public static void Main(){ char ch = 'e'; Console.WriteLine("Character value = "+ch); int res = Uri.FromHex(ch); Console.WriteLine("Converted int value = "+res); if(Uri.IsHexDigit(ch)) { Console.WriteLine("Valid hexadecimal digit"); } else { ... Read More
244 Views
Queue.CopyTo(T[], Int32) Method is used to copy the Queue elements to a 1-D array.ExampleLet us now see an example −using System; using System.Collections.Generic; public class Demo{ public static void Main(){ Queue queue = new Queue(); queue.Enqueue("K"); queue.Enqueue("T"); String[] strArr = new String[4]; strArr[0] = "One"; strArr[1] = "Two"; strArr[2] = "Three"; strArr[3] = "Four"; Console.WriteLine("Array elements: "); for (int i = 0; i < strArr.Length; i++){ ... Read More
299 Views
The Console.SetBufferSize() Method in C# is used to set the height and width of the screen buffer area to the specified values.SyntaxThe syntax is as follows −public static void SetBufferSize (int width, int height);Above, the parameter width is the width of the buffer area, whereas height is the height of the buffer area.ExampleLet us now see an example to implement the Console.SetBufferSize() Method in C# −using System; class Demo { public static void Main (string[] args) { Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Red; Console.SetBufferSize(400, 400); while (true) ... Read More
391 Views
The Console.ResetColor() method in C# is used to set the foreground and background console colors to their defaults.SyntaxThe syntax is as follows −public static void ResetColor ();ExampleLet us now see an example to implement the Console.ResetColor() method in C# −using System; class Demo { public static void Main (string[] args) { Console.WriteLine ("At first, we have set colors here...After that, we will reset the colors to default."); Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine ("Colors are set for this text"); Console.ResetColor(); ... Read More
1K+ Views
The Console.ReadLine() method in C# is used to read the next line of characters from the standard input stream.SyntaxThe syntax is as follows −public static string ReadLine ();ExampleLet us now see an example to implement the Console.ReadLine() method in C# −using System; public class Demo{ public static void Main(){ string str; Console.WriteLine("Enter any subject..."); str = Console.ReadLine(); Console.WriteLine("Entered subject = "+str); } }OutputThis will produce the following output −Enter any subject... Entered subject = Maths