Difference between TimeSpan Seconds() and TotalSeconds()

karthikeya Boyini
Updated on 23-Jun-2020 07:36:57

2K+ Views

TimeSpan Seconds() is part of time, whereas TimeSpan TotalSeconds() converts entire time to seconds.Let us first see the TimeSpan Seconds() method.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);       // seconds       Console.WriteLine(ts.Seconds);    } }Output20Now, let us see how TotalSeconds works for the same TimeSpan value.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan ts = new TimeSpan(0, 100, 0, 20, 0);       // ... Read More

Convert.ToChar Method in C#

Chandu yadav
Updated on 23-Jun-2020 07:35:47

641 Views

The Convert.ToChar method is used to convert a specified value to a Unicode integer.We have declared an sbyte variable.sbyte byteVal = 200;Now, use the Convert.ToChar() method to convert the sbyte value to a Unicode integer.charVal = Convert.ToChar(b);Let us see another example.Example Live Demousing System; public class Demo {    public static void Main() {       sbyte[] byteVal = { 92, 111, 115 };       char charVal;       foreach (sbyte b in byteVal) {          charVal = Convert.ToChar(b);          Console.WriteLine("{0} converted to '{1}'", b, charVal);       }    } }Output92 converted to '\' 111 converted to 'o' 115 converted to 's'

Convert.ToDateTime Method in C#

Samual Sam
Updated on 23-Jun-2020 07:35:19

512 Views

The Convert.ToDateTime method converts a given value to a DateTime value.The following is my string.string myDateString; myDateString = "09/09/2018";Now, let us convert it using the Convert.ToDateTime() method.DateTime result; result = Convert.ToDateTime(myDateString);Here is the complete example.Example Live Demousing System; public class Demo {    public static void Main() {       string myDateString;       DateTime result;       myDateString = "09/09/2018";       result = Convert.ToDateTime(myDateString);       Console.WriteLine("'{0}' converted to {1}", myDateString, result);    } }Output'09/09/2018' converted to 9/9/2018 12:00:00 AM

Different Star Pattern Programs in C#

George John
Updated on 23-Jun-2020 07:34:56

9K+ Views

Like any other programming languages such as C, C++, Java, we can easily display start pattern programs in C#.Let us see them one by one.Example Live Demousing System.IO; using System; class Program {    static void Main() {       for (int i = 1; i

With JavaScript DOM delete rows in a table?

Sharon Christine
Updated on 23-Jun-2020 07:33:28

5K+ Views

To delete rows in a table in JavaScript, use the DOM deleteRow() method.ExampleYou can try to run the following code to learn how to delete rows in a table. The code deletes rows one at a time −Live Demo                 function captionFunc(x) {          document.getElementById(x).createCaption().innerHTML = "Demo Caption";       }                                           One             Two                                 Three             Four                                 Five             Six                                                                

How to create a table caption with JavaScript DOM?

Jai Janardhan
Updated on 23-Jun-2020 07:32:58

302 Views

To create a table caption, use the DOM createCaption() method.ExampleYou can try to run the following code to learn how to create table caption −Live Demo                    function captionFunc(x) {             document.getElementById(x).createCaption().innerHTML = "Demo Caption";          }                                           One             Two                                 Three             Four                                 Five             Six                                          

C# Program to merge sequences

karthikeya Boyini
Updated on 23-Jun-2020 07:32:51

105 Views

Let’s add two sequences.Integer Array.int[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8 };String Array.string[] stringArray = { "Depp", "Cruise", "Pitt", "Clooney", "Sandler", "Affleck", "Tarantino" };Now to merge both the above sequences, use the Zip method.ntArray.AsQueryable().Zip(stringArray, (one, two) => one + " " + two);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[] intArray = { 1, 2, 3, 4, 5, 6, 7, 8 };       string[] stringArray = { "Depp", "Cruise", "Pitt", "Clooney", "Sandler", "Affleck", "Tarantino"   ... Read More

How to perform Multiline matching with JavaScript RegExp?

Moumita
Updated on 23-Jun-2020 07:32:31

425 Views

To perform multiline matching, use the M modifier available in JavaScript Regular Expression.ExampleYou can try to run the following code to perform multiline matching −           JavaScript Regular Expression                        var myStr = "Welcoming!";          var reg = /^ing/m;          var match = myStr.match(reg);                    document.write(match);          

C# Program to create a LinkedList

Arjun Thakur
Updated on 23-Jun-2020 07:32:15

150 Views

Firstly, set a string array.string [] students = {"Tim","Jack","Henry","David","Tom"};Now, add it to the LinkedList.LinkedList list = new LinkedList(students);The above creates a LinkedList and adds node to it.Let us see the complete example.Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       string [] students = {"Tim","Jack","Henry","David","Tom"};       LinkedList list = new LinkedList(students);       foreach (var stu in list) {          Console.WriteLine(stu);       }    } }OutputTim Jack Henry David Tom

Which is the JavaScript RegExp to find any alternative text?

Nikitha N
Updated on 23-Jun-2020 07:32:05

123 Views

To match any of the specified alternatives, follow the below-given pattern −(foo|bar|baz)ExampleYou can try to run the following code to find any alternative text −           JavaScript Regular Expression                        var myStr = "one,one,one, two, three, four, four";          var reg = /(one|two|three)/g;          var match = myStr.match(reg);          document.write(match);          

Advertisements