Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 12 of 73

Sizing Bootstrap pagination-* class

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 386 Views

To size Bootstrap pagination-* class, use the pagination-lg and pagination-sm class.You can try to run the following code to size pagination −Example           Bootstrap Example                                 Questions       Large Pagination                «          Q1          Q2          Q3          Q4          Q5          »                   Small Pagination                «          Q1          Q2            Q3          Q4          Q5          »          

Read More

How to check if String is Palindrome using C#?

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 539 Views

Let’s say we need to find that the following string is Palindrome or not −str = "Level";For that, convert the string into character array to chec each character −char[] ch = str.ToCharArray();Now find the reverse −Array.Reverse(ch);Use the Equals method to find whether the reverse is equal to original array or not −bool res = str.Equals(rev, StringComparison.OrdinalIgnoreCase);The following is the complete code −Exampleusing System; namespace Demo {    class Program {       static void Main(string[] args) {          string str, rev;          str = "Level";          char[] ch = ...

Read More

C# program to display the next day

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 3K+ Views

To display the next day, use the AddDays() method and a value +1 to get the next day.Firstly, use the following to get the current day −DateTime.TodayNow, add 1 to the AddDays() method to get the next day −DateTime.Today.AddDays(1)The following is the code −Exampleusing System; using System.Collections.Generic; using System.Linq; public class Demo {    public static void Main() {       Console.WriteLine("Today = {0}", DateTime.Today);       Console.WriteLine("Previous Day = {0}", DateTime.Today.AddDays(-1));       Console.WriteLine("Next Day (Tomorrow) = {0}", DateTime.Today.AddDays(1));    } }OutputToday = 9/4/2018 12:00:00 AM Previous Day = 9/3/2018 12:00:00 AM Next Day (Tomorrow) = 9/5/2018 12:00:00 AM

Read More

What are file operations in C#?

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 469 Views

C# has the following file operations −Create, open, read and write a file.Append, Delete, etc.The FileStream class in the System.IO namespace helps in reading from, writing to and closing files. This class derives from the abstract class Stream.You need to create a FileStream object to create a new file or open an existing file. The syntax for creating a FileStream object is as follows −FileStream = new FileStream( , , , );Here, the file operations are also included as shown below −The FileMode enumerator defines various methods for opening files. The members of the FileMode enumerator are −Append − It ...

Read More

C# TicksPer constants

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 269 Views

TicksPer constants in C# have TicksPerDay, TicksPerHour, TicksPerMinute, TicksPerSecond, and TicksPerMillisecond constants. A millisecond consists of 10,000 ticks.Here are the TicksPer constants −TimeSpan.TicksPerDay TimeSpan.TicksPerHour TimeSpan.TicksPerMinuteExampleusing System; using System.Linq; public class Demo {    public static void Main() {       // TicksPer constant       Console.WriteLine(TimeSpan.TicksPerDay);       Console.WriteLine(TimeSpan.TicksPerHour);       Console.WriteLine(TimeSpan.TicksPerMinute);    } }Output864000000000 36000000000 600000000

Read More

C# Program to set the timer to zero

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 497 Views

To set the timer information to zero, use the Stopwatch Restart method.Firstly, begin the Stopwatch −Stopwatch s = Stopwatch.StartNew();Then, use Restart() to set the timer to zero −s.Restart();Let us see the complete code −Exampleusing System; using System.Threading; using System.Diagnostics; public class Demo {    public static void Main() {       Stopwatch s = Stopwatch.StartNew();       Thread.Sleep(500);       // restart       s.Restart();       // begin again       Thread.Sleep(500);       Console.WriteLine(s.Elapsed);    } }Output00:00:00.5004937

Read More

ContainsKey in C#

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 2K+ Views

ContainsKey is a Dictionary method in C# and check whether a key exists in the Dictionary or not.Declare a Dictionary and add elements −var dict = new Dictionary() {    {"TV", 1},    {"Home Theatre", 2},    {"Amazon Alexa", 3},    {"Google Home", 5},    {"Laptop", 5},    {"Bluetooth Speaker", 6} };Now, let’s say you need to check for the existence of a particular element in the Dictionary. For that, use the ContainsKey() method −if (dict.ContainsKey("Laptop") == true) {    Console.WriteLine(dict["Laptop"]); }The following is the code −Exampleusing System; using System.Collections.Generic; public class Demo {    public static void Main() { ...

Read More

Add HTML headings into Bootstrap thumbnails

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 317 Views

With Bootstrap, you can easily add heading to thumbnails.You can try to run the following code to add HTML headings −Example           Bootstrap Example                                                                                                              Thumbnail Heading                                

Read More

Include list groups within any Bootstrap Panel

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 182 Views

To include list groups within Bootstrap panel, create a panel by adding class .panel to the element.Also, add class .panel-default to this element. Now within this panel include your list groups.Example           Bootstrap Example                                          Tutorials                       List of tutorials                                 C             Java             Ruby             C++                    

Read More

TakeWhile method in C# ()

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 507 Views

With the TakeWhile() method, you can get methods by setting a condition base on Predicate.Firstly, declare and initialize an array −int[] arr = { 25, 40, 65, 70};Now, use the TakeWhile() method and predicate to get all the elements that are less than 30.var val = arr.TakeWhile(ele => ele < 30);Let us see the same example, wherein we have displayed the values less than 30 using Predicate −Exampleusing System; using System.Linq; using System.IO; public class Demo {    public static void Main() {       int[] arr = { 25, 40, 65, 70};       var val = arr.TakeWhile(ele => ele < 30);       foreach (int res in val) {          Console.WriteLine(res);       }    } }Output25

Read More
Showing 111–120 of 730 articles
« Prev 1 10 11 12 13 14 73 Next »
Advertisements