Ankith Reddy

Ankith Reddy

730 Articles Published

Articles by Ankith Reddy

Page 11 of 73

Footer of the modal in Bootstrap

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

To set the footer of the Bootstrap modal, use the .modal-footer class.You can try to run the following code to implement the modal-footer class −Example           Bootstrap Example                                          Examination          Result                                                                              ×                      Warning                                                          If JavaScript isn't enabled in your web browser, then you may not be able to see the result.                                                          Close                                                                  

Read More

How to capture out of memory exception in C#?

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

The System.OutOfMemoryException occurs when the CLR fail in allocating enough memory that is needed.System.OutOfMemoryException is inherited from the System.SystemException class.Set the strings −string StudentName = "Tom"; string StudentSubject = "Maths";Now you need to initialize with allocated Capacity that is the length of initial value −StringBuilder sBuilder = new StringBuilder(StudentName.Length, StudentName.Length);Now, if you will try to insert additional value, the exception occurs.sBuilder.Insert(value: StudentSubject, index: StudentName.Length - 1, count: 1);The following exception occurs −System.OutOfMemoryException: Out of memoryTo capture the error, try the following code −Exampleusing System; using System.Text; namespace Demo {    class Program {       static void Main(string[] ...

Read More

C# program to find the index of a word in a string

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

Declare and initialize an array −string[] str = new string[] {    "Cat",    "Mat",    "Rat" };Now, ue IndexOf() method to find the index of the word “Mat” −Array.IndexOf(str, "Mat");The following is the code −Exampleusing System; public class Demo {    public static void Main() {       string[] str = new string[] {          "Cat",          "Mat",          "Rat"       };       Console.WriteLine("Our Array =");       for (int i = 0; i < str.Length; i++) {          string res = str[i];          Console.WriteLine(res);       }       int findIndex = Array.IndexOf(str, "Mat");       Console.Write("Element Mat found at the following index: ");       Console.WriteLine(findIndex);    } }OutputOur Array = Cat Mat Rat Element Mat found at the following index: 1

Read More

Add responsive features to Bootstrap navbar

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

To add responsive features to the navbar, the content that you want to be collapsed needs to be wrapped in a with classes .collapse, .navbar-collapse.You can try to run the following code toExample           Bootstrap Example                                                                      Toggle navigation                                                                               Tools                                                Online Compiler                Image Editor                                                        Whiteboard                                                                                Image Optimizer                                                                  

Read More

Default operator in C#

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

Using the default, you can get the default value of every reference and value type. The expressions set as default are evaluated at compile-time.To get the default for int −default(int);To get the default for long −default(long)Let us see the code to display default values −Exampleusing System; public class Demo {    public static void Main() {       int val1 = default(int);       long val2 = default(long);       bool val3 = default(bool);       // default for int       Console.WriteLine(val1);       // default for long       Console.WriteLine(val2);       // default for bol       Console.WriteLine(val3);    } }Output0 0 False

Read More

Enum.GetName in C#

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

Gets the string representation of an Enum value using the Enum.GetName.It has two parameters −Type − Enumeration typeObject − Value of an enumerationThe following is an example −Exampleusing System; class Demo {    enum Vehicle {       Car,       Motorbike,       Truck,       Bicycles    };    static void Main() {       // Usig GetName to get the string representation of enum type       string res = Enum.GetName(typeof(Vehicle), Vehicle.Motorbike);           // Displaying       Console.WriteLine(res);    } }OutputMotorbike

Read More

Wrap Strings of Text in Bootstrap Navbar

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

To wrap strings of text in an element using the class .navbar-text.ExampleYou can try to run the following code to set text in Bootstrap Navbar −           Bootstrap Example                                                       Demo                                 Copyright © 2018                    

Read More

C# program to count number of bytes in an array

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

Set a byte array −byte[] b = { 5, 9, 19, 23, 29, 35, 55, 78 };To count number of bytes −Buffer.ByteLength(b)The following is the code −Exampleusing System; class Program {    static void Main() {       byte[] b = { 5, 9, 19, 23, 29, 35, 55, 78 };       int len = Buffer.ByteLength(b);       for (int i = 0; i < len; i++) {          Console.WriteLine(b[i]);       }       Console.WriteLine("Length of byte array = "+len);    } }Output5 9 19 23 29 35 55 78 Length of byte array = 8

Read More

What are floating point literals in C#?

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

A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part. You can represent floating point literals either in decimal form or exponential form.The following are some of the examples of floating point literals −9.23456 269485E-5FLet us now print the floating point literals −Exampleusing System; namespace Demo {    class Program {       static void Main(string[] args) {          // float          float a = 3.56f;          Console.WriteLine(a);          // float          float b = 3.14159f;          Console.WriteLine(b);       }    } }Output3.56 3.14159

Read More

What are generic collections in C#?

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

Generic collections in C# include , , etc.ListList is a generic collection and the ArrayList is a non-generic collection.Let us see an example. Here, we have six elements in the list −Exampleusing System; using System.Collections.Generic; class Program {    static void Main() {       // Initializing collections       List myList = new List() {          "one",          "two",          "three",          "four",          "five",          "six"       };       Console.WriteLine(myList.Count);   ...

Read More
Showing 101–110 of 730 articles
« Prev 1 9 10 11 12 13 73 Next »
Advertisements