JavaScript Event When Element's Content is Cut

V Jyothi
Updated on 23-Jun-2020 09:11:38

149 Views

The oncut event occurs when an element’s content is cut. You can try to run the following code to learn how to work with an oncut event in JavaScript −Example                          function cutFunction() {             document.write("Text cut!");          }          

Convert ToUInt32 Method in C#

karthikeya Boyini
Updated on 23-Jun-2020 09:11:34

312 Views

Convert a specified value to a 32-bit unsigned integer using the Convert.ToUInt32 method.The following is our string.string str = "210";Now, let us convert it to a 32-bit unsigned integer.uint res; res = Convert.ToUInt32(str);Example Live Demousing System; public class Demo {    public static void Main() {       string str = "210";       uint res;       res = Convert.ToUInt32(str);       Console.WriteLine("Converted string '{0}' to {1}", str, res);    } }OutputConverted string '210' to 210

C# Enum Format Method

Chandu yadav
Updated on 23-Jun-2020 09:11:16

796 Views

The Format method converts value of a specified enumerated type to its equivalent string representation. Here you can also set the format i.e. d for Decimal, x for HexaDecimal, etc.We have the following enumeration.enum Stock { PenDrive, Keyboard, Speakers };The default value gets assigned (initialize).PenDrive = 0 Keyboard = 1 Speakers = 2Now, let’s say you want the value of “Keyboard” name.Stock st = Stock.Keyboard;For that, try the following and get the constant value for Keyboard name.Enum.Format(typeof(Stock), st, "d")The following is the entire example.Example Live Demousing System; class Demo {    enum Stock { PenDrive, Keyboard, Speakers };    static void ... Read More

C# Program to Return Specified Number of Elements from the Beginning of a Sequence

Arjun Thakur
Updated on 23-Jun-2020 09:10:41

171 Views

Set an array and arrange it in descending order using OrderByDescending.int[] prod = { 290, 340, 129, 540, 456, 898, 765, 789, 345};Now, use the Take() method to return specified number of elements from the beginning.Enumerable units = prod.AsQueryable().OrderByDescending(s => s).Take(2);Let us see the complete code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; public class Demo {    public static void Main() {       int[] prod = { 290, 340, 129, 540, 456, 898, 765, 789, 345};       // Volume of top two products       IEnumerable units = prod.AsQueryable().OrderByDescending(s => s).Take(2);       foreach (int res in units) {          Console.WriteLine(res);       }    } }Output898 789

C# Program to Access Tuple Elements

Ankith Reddy
Updated on 23-Jun-2020 09:09:46

334 Views

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

Tuple Rest Property in C#

Samual Sam
Updated on 23-Jun-2020 09:08:58

309 Views

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

Usage of onreset Event in JavaScript

Anjana
Updated on 23-Jun-2020 09:08:43

373 Views

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:                    

Create a Quadruple Tuple in C#

George John
Updated on 23-Jun-2020 09:08:28

248 Views

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

Chash Math DivRem Method

karthikeya Boyini
Updated on 23-Jun-2020 09:07:46

212 Views

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

C# Math BigMul Method

Ankith Reddy
Updated on 23-Jun-2020 09:07:03

205 Views

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

Advertisements