Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Articles by Ankith Reddy
Page 11 of 73
Footer of the modal in Bootstrap
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 MoreHow to capture out of memory exception in C#?
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 MoreC# program to find the index of a word in a string
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 MoreAdd responsive features to Bootstrap navbar
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 MoreDefault operator in C#
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 MoreEnum.GetName in C#
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 MoreWrap Strings of Text in Bootstrap Navbar
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 MoreC# program to count number of bytes in an array
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 MoreWhat are floating point literals in C#?
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 MoreWhat are generic collections in C#?
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