Create a tuple.var myTuple = Tuple.Create(1, 2.5M, "Amit", "100");Now to access tuple elements, use the properties.To access first element.myTuple.Item1To access second element.myTuple.Item2In the same way, for other elements, use the properties as shown below −Example Live Demousing System; public class Program { public static void Main() { var myTuple = Tuple.Create(1, 2.5M, "Amit", "100"); Console.WriteLine("Item1 : "+ myTuple.Item1); Console.WriteLine("Item2 : "+ myTuple.Item2); Console.WriteLine("Item3 : "+ myTuple.Item3); Console.WriteLine("Item4 : "+ myTuple.Item4); } }OutputItem1 : 1 Item2 : 2.5 Item3 : Amit Item4 : 100
Create tuples of eight or more elements by nesting tuple objects in the Rest property.The tuple would look like −TupleAbove, the 8th element is added using Rest property.Let us see an example.Example Live Demousing System; public class Program { public static void Main() { var myTuple = Tuple.Create(1, 2.5M, "Tom", "100", 5, 10.5M, "Henry", "100"); Console.WriteLine("Item1 : "+ myTuple.Item1); Console.WriteLine("Item2 : "+ myTuple.Item2); Console.WriteLine("Item3 : "+ myTuple.Item3); Console.WriteLine("Item4 : "+ myTuple.Item4); Console.WriteLine("Item5 : "+ myTuple.Item5); Console.WriteLine("Item6 : "+ myTuple.Item6); ... Read More
The onreset event is useful when a form is reset. You can try to run the following code to learn how to implement onreset event in JavaScript −Example function resetFunct() { alert("The form was reset"); } Enter age: Enter birth month:
Quadruple is a tuple with four items.Create a tuple first.var myTuple = Tuple.Create(100, 200, 300, 400);Above, we have created a tuple with four items i.e. Quadruple. Now to access all the four items.myTuple.Item1 myTuple.Item2 myTuple.Item3 myTuple.Item4Example Live Demousing System; public class Program { public static void Main() { var myTuple = Tuple.Create(100, 200, 300, 400); Console.WriteLine("Item1 : "+ myTuple.Item1); Console.WriteLine("Item2 : "+ myTuple.Item2); Console.WriteLine("Item3 : "+ myTuple.Item3); Console.WriteLine("Item4 : "+ myTuple.Item4); } }OutputItem1 : 100 Item2 : 200 Item3 : 300 Item4 : 400
Use the Math.DivRem method to calculate the quotient of two numbers and return the remainder.Firstly, set dividend and divisor.// dividend long dividend = 30; // divisor long divisor = 7;Now, use the DivRem method.long quotient = Math.DivRem(dividend, divisor, out rem);Example Live Demousing System; using System.Globalization; class Demo { static void Main() { // remainder long rem; // dividend long dividend = 98; // divisor long divisor = 9; long quotient = Math.DivRem(dividend, divisor, out rem); Console.WriteLine("{0} \ {1} = {2} and remainder = {3}", dividend, divisor, quotient, rem); } }Output98 \ 9 = 10 and remainder = 8
Use the Math.BigMul() method to find the product of two 32-bit numbers.The following are our two numbers.int one = 345272828; int two = 887685744;Now, get the product.long res; res = Math.BigMul(one, two);Example Live Demousing System; using System.Globalization; class Demo { static void Main() { int one = 345272828; int two = 887685744; long res; res = Math.BigMul(one, two); Console.WriteLine("{0} * {1} = {2}", one, two, res); } }Output345272828 * 887685744 = 306493767206164032
The onfocusin event triggers when an element is to get focus. You can try to run the following code to learn how to implement onfocusin event in JavaScript −Example Write below: function newFunc(x) { x.style.background = "blue"; }
When a value is added in an input box, then the oninput event occurs. You can try to run the following code to learn how to implement oninput event in JavaScript −Example Write below: function inputFunc() { var a = document.getElementById("newInput").value; document.write("Typed: " + a); }
Int32 represents a 32-bit signed integer. To represent it as a string, use the ToString() method.Firstly, declare and initialize an Int32 variable.int val = 1023;Now, represent it as a string.val.ToString()Let us see the complete example.Example Live Demousing System; class Demo { static void Main() { int val = 1023; Console.Write("Integer converted to string = "+val.ToString()); } }OutputInteger converted to string = 1023
The WindowWidth property gets or sets the width of the console window.Declare a variable.int width;Now, get the width of the current window.width = Console.WindowWidth;The following is the complete example.Example Live Demousing System; using System.Numerics; using System.Globalization; class Demo { static void Main() { int width; int height; width = Console.WindowWidth; height = Console.WindowHeight; Console.WriteLine("Current window width = "+width); Console.WriteLine("Current window height = "+height); } }OutputCurrent window width = 0 Current window height = 0
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP