Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 10 of 73

Pair Class in C#

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

The Pair class is the KeyValuePair class that stores a pair of values in a single list with C#.Declare KeyValuePair −var myList = new Liststring, int>>(); Now, add some elements: myList.Add(new KeyValuePair("Laptop", 1)); myList.Add(new KeyValuePair("Desktop System", 2)); myList.Add(new KeyValuePair("Tablet", 3)); myList.Add(new KeyValuePair("Mobile", 4)); myList.Add(new KeyValuePair("E-Book Reader", 5)); myList.Add(new KeyValuePair("LED", 6));Display the KeyValuePair now as shown below −Exampleusing System; using System.Collections.Generic; class Program {    static void Main() {       var myList = new List();       // adding elements       myList.Add(new KeyValuePair ("Laptop", 1));       myList.Add(new KeyValuePair ("Desktop System", 2));     ...

Read More

Reverse a Stack using C#

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

Set a stack and add elements to it.Stack st = new Stack(); st.Push('P'); st.Push('Q'); st.Push('R');Now set another stack to reverse it.Stack rev = new Stack();Until the count of ths Stack is not equal to 0, use the Push and Pop method to reverse it.while (st.Count != 0) {    rev.Push(st.Pop()); }The following is the complete code −Exampleusing System; using System.Collections; namespace CollectionsApplication {    public class Program {       public static void Main(string[] args) {          Stack st = new Stack();          Stack rev = new Stack();         ...

Read More

Create a striped Bootstrap progress bar

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

Follow the below given steps to create a striped progress bar in Bootstrap −Add a with a class of .progress and .progress-striped.Next, inside the above , add an empty with a class of .progress-bar and class progress-bar-* where * could be success, info, warning, danger.Add a style attribute with the width expressed as a percentage. Say, for example, style = "60%"; indicates that the progress bar was at 60%.You can try to run the following code to form a striped progress bar −Example           Bootstrap Example                                 Striped Progress Bars       Warning Progress Bar                             45%Complete (warning)                       Danger Progress Bar                             80% Complete (danger)                    

Read More

How to find the length of jagged array using a property?

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

Firstly, declare and initialize a jagged array.int[][] arr = new int[][] { new int[] {    0,    0 }, new int[] {    1,    2 }, new int[] {    2,    4 }, new int[] {    3,    6 }, new int[] {    4,    8 } };Now use the length property to get the length.arr.LengthThe following is the complete code −Exampleusing System; public class Program {    public static void Main() {       int[][] arr = new int[][]{new int[]{0,0},new int[]{1,2}, new int[]{2,4},new int[]{ 3, 6 }, new       int[]{ 4, 8 } };       // Length       Console.WriteLine("Length:"+arr.Length);       Console.WriteLine("Upper Bound: {0}",arr.GetUpperBound(0).ToString());       Console.WriteLine("Lower Bound: {0}",arr.GetLowerBound(0).ToString());       Console.WriteLine("Dimensions of Array : " + arr.Rank);    } }OutputLength:5 Upper Bound: 4 Lower Bound: 0 Dimensions of Array : 1

Read More

Set important information for a list item in a list group with Bootstrap

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

use the list-group-item-info class in Bootstrap to set key information for a list item in a list group.You can try to run the following code to implement the list-group-item-info class −Example           Bootstrap Example                                          Java                                      Interfaces                                        Multi-threading                                        Packages                                

Read More

Nest button groups with Bootstrap

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

Nest button groups within another button group i.e, place a .btn-group within another .btn-group. This is done when you want dropdown menus mixed with a series of buttons.To nest button groups, you can try to run the following code −Example           Bootstrap Example                                          Rank          Marks                                      Subjects                                                        Maths                Science                English                                

Read More

C# Program to replace a character with asterisks in a sentence

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

Use the Replace() method to replace a character with asterisks.Let’s say our string is −string str = "dem* text";To replace it, use the Replace() method −str.Replace('*', 'o');Here is the complete code −Exampleusing System; public class Program {    public static void Main() {       string str = "dem* text";       Console.WriteLine("Initial string = " + str);       string res = str.Replace('*', 'o');       // after replacing       Console.WriteLine("After replacing asterisk = " + res.ToString());    } }OutputInitial string = dem* text After replacing asterisk = demo text

Read More

Align media objects with Bootstrap

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

To align media objects, use the .align class in Bootstrap. You can try to run the following code to implement the .align class.Use the .align-left class to align media to the left −Example           Bootstrap Example                                          Google Tag Manager Tutorial                                                                              Introduction                Google Tag Manager (GTM) is a free tool that makes it easy for marketers to add and update website tags.                                

Read More

How to find the length and rank of a jagged array in C#?

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

Firstly, set a jagged array.int[][] arr = new int[][] {    new int[] {       0,       0    }, new int[] {       1,       2    },    new int[] {       2,       4    }, new int[] {       3,       6    }, new int[] {       4,       8    } };Now, use the GetLowerBound(), GetUpperBound() and Rank property to get the lenth and rank of the array as shown in the following code ...

Read More

Style the Bootstrap modal

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

Use the .modal-body class in Bootstrap to style the modal.You can try to run the following code to style modal −/p>Example           Bootstrap Example                                          Website Information          Info                                                                              ×                      Warning                                                          If JavaScript isn't enabled in your web browser, then you may not be able to see this information correcty.                                                          Close                                                                  

Read More
Showing 91–100 of 730 articles
« Prev 1 8 9 10 11 12 73 Next »
Advertisements