Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 25 of 81

Ways to print escape characters in C#

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 1K+ Views

The following are the escape characters in C# and the display column suggests how to use and print them in C# −Escape CharacterDescriptionPatternDisplay\aMatches a bell character, \u0007.\a"\u0007" in "Warning!" + '\u0007'\bIn a character class, matches a backspace, \u0008.[\b]{3, }"\b\b\b\b" in "\b\b\b\b"\tMatches a tab, \u0009.(\w+)\t"Name\t", "Addr\t" in "Name\tAddr\t"\rMatches a carriage return, \u000D. (\r is not equivalent to the newline character, .)\r(\w+)"\rHello" in "\r\HelloWorld."\vMatches a vertical tab, \u000B.[\v]{2, }"\v\v\v" in "\v\v\v"\fMatches a form feed, \u000C.[\f]{2, }"\f\f\f" in "\f\f\f"Matches a new line, \u000A.\r(\w+)"\rHello" in "\r\HelloWorld."\eMatches an escape, \u001B.\e"\x001B" in "\x001B"nnUses octal representation to specify a character (nnn consists of up to three digits).\w\040\w"a ...

Read More

TimeSpan.From methods in C# ()

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 219 Views

The TimeSpan.From methods include FromDays, FromHours, FromMinutes, etc.To get the TimeSpan for all the methods// Days TimeSpan t1 = TimeSpan.FromDays(1); // Hours TimeSpan t2 = TimeSpan.FromHours(1); // Minutes TimeSpan t3 = TimeSpan.FromMinutes(1);The following is the code that works on all the TimeSpan methods −Exampleusing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan t1 = TimeSpan.FromDays(1);       TimeSpan t2 = TimeSpan.FromHours(1);       TimeSpan t3 = TimeSpan.FromMinutes(1);       Console.WriteLine(t1);       Console.WriteLine(t2);       Console.WriteLine(t3);    } }Output1.00:00:00 01:00:00 00:01:00

Read More

Format TimeSpan in C#

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 3K+ Views

You can format a TimeSpan in the hh: mm: ss format in C#.Firstly, set the TimeSpan −TimeSpan ts = new TimeSpan(9, 15, 30);To format TimeSpan −{0:hh\:mm\:ss}The following is the code −Exampleusing System; using System.Linq; public class Demo {    public static void Main() {       TimeSpan ts = new TimeSpan(9, 15, 30);       Console.WriteLine("{0:hh\:mm\:ss}", ts);    } }Output09:15:30

Read More

Bootstrap page-header class

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 680 Views

Page header is used to add appropriate spacing around the headings on a page.To use a page header, wrap your heading in a with a class of .page-header −Example           Bootstrap Example                                                       Header             Subtext for header                       Demo text! Demo text! Demo text! Demo text! Demo text!          Demo text! Demo text! Demo text! Demo text!          

Read More

Display years in different formats with C# DateTime

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 205 Views

Set a DateTime object;DateTime dt = DateTime.Now;To get years in different formats, try the following −dt.ToString("yy") dt.ToString("yyy") dt.ToString("yyyy") dt.ToString("yyyyy")Here is the complete code −Exampleusing System; using System.Threading; using System.Diagnostics; public class Demo {    public static void Main() {       DateTime dt = DateTime.Now;       // Today's date       Console.WriteLine("Today = {0}", DateTime.Today);       Console.WriteLine("Displaying current year in dufferent formats:");       Console.WriteLine(dt.ToString("yy"));       Console.WriteLine(dt.ToString("yyy"));       Console.WriteLine(dt.ToString("yyyy"));       Console.WriteLine(dt.ToString("yyyyy"));    } }OutputToday = 9/4/2018 12:00:00 AM Displaying current year in dufferent formats: 18 2018 2018 02018

Read More

C# program to convert string to long

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 15K+ Views

To convert a string to a long, use the Long.parse method in C# −Firstly, set a string −string str = "6987646475767";Now, convert it to long −long.Parse(str);Here is the complete code −Exampleusing System; using System.Linq; class Demo {    static void Main() {       string str = "6987646475767";       long res = long.Parse(str);       Console.WriteLine(res);    } }Output6987646475767

Read More

Usage of Bootstrap class panel-danger

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 418 Views

The .panel-danger class in Bootstrap is used to indicate danger.You can try to run the following code to implement panel-danger class −Example           Bootstrap Example                                                       Panel title (danger)                                 This is a Basic panel                    

Read More

KeyNotFoundException in C#

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 632 Views

The KeyNotFoundException is thrown when a key you are finding is not available in the Dictionary collection.Let us see an example −Exampleusing System; using System.Collections.Generic; public class Demo {    public static void Main() {       try {          var dict = new Dictionary() {             {"TV", "Electronics"},             {"Laptop", "Computers"},          };          Console.WriteLine(dict["Pen Drive"]);       }       catch (Exception e) {          Console.WriteLine(e);       }    } }The ...

Read More

What is the Count property of SortedList class in C#?

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 166 Views

Exampleusing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] args) {          SortedList s = new SortedList();          s.Add("S1", "Electronics");          s.Add("S2", "Clothing");          s.Add("S3", "Applicances");          s.Add("S4", "Books");          s.Add("S5", "Accessories");          s.Add("S6", "Musical Instruments");          Console.WriteLine("Count = " + s.Count);       }    } }OutputCount = 6

Read More

Create Dismissal Alerts in Bootstrap

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 412 Views

To create a dismissal alert −Add a basic alert by creating a wrapper and adding a class of .alert and one of the four contextual classes, for example, .alert-success, .alert-info, etc.Also add optional .alert-dismissable to the above class.Add a close button.You can try to run the following code to create dismissal alerts −Example           Bootstrap Example                                                       ×                    Success! Well done its submitted.                                   ×                    Info! Take this info.          

Read More
Showing 241–250 of 810 articles
« Prev 1 23 24 25 26 27 81 Next »
Advertisements