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 Chandu yadav
Page 11 of 81
How to find the size of a list in C#?
Declare and initialize a list.var products = new List (); products.Add("Accessories"); products.Add("Clothing"); products.Add("Footwear");To get the size, use the Capacity property.products.CapacityNow let us see the complete code to find the size of a list.Exampleusing System; using System.Collections.Generic; public class Demo { public static void Main(string[] args) { var products = new List (); products.Add("Accessories"); products.Add("Clothing"); products.Add("Footwear"); Console.WriteLine("Our list...."); foreach(var p in products) { Console.WriteLine(p); } Console.WriteLine("Size of list = " + products.Capacity); } }OutputOur list.... Accessories Clothing Footwear Size of list = 4
Read MoreBootstrap Pills
To turn the tabs into pills, use the class .nav-pills,You can try to run the following code to implement Bootstrap Pills:Example Bootstrap Example Subjects Java WordPress JavaScript AngularJS
Read MoreDisable a dropdown item with Bootstrap
To disable to dropdown item in Bootstrap, use the .disabled class with the .dropdown-menu class.You can try to run the following code to disable dropdown item −Example Bootstrap Example Beverages The following are the beverages available in India: Beverages Gatorade Sting Red Bull Pepsi Coca Cola
Read MoreHow to delete/remove an element from a C# array?
To delete an elements from a C# array, we will shift the elements from the position the user want the element to delete.Here, first we have 5 elements −int[] arr = new int[5] {35, 50, 55, 77, 98};Now let’s say we need to delete the element at 2nd position i.e. variable “pos = 2” is set, for that shift the elements after the specified position −// Shifting elements for (i = pos-1; i < 4; i++) { arr[i] = arr[i + 1]; }Now display the result as shown in the complete code below.Exampleusing System; using System.Collections.Generic; using System.Linq; using ...
Read MoreC# program to iterate over a string array with for loop
Create a string array −string[] str = new string[] { "Videos", "Tutorials", "Tools", "InterviewQA" };Loop until the length of the array −for (int i = 0; i < str.Length; i++) { string res = str[i]; Console.WriteLine(res); }Here is the complete code −Exampleusing System; public class Demo { public static void Main() { string[] str = new string[] { "Videos", "Tutorials", "Tools", "InterviewQA" }; Console.WriteLine("String Array..."); for (int i = 0; i < str.Length; i++) { string res = str[i]; Console.WriteLine(res); } } }OutputString Array... Videos Tutorials Tools InterviewQA
Read MoreHow to get the nth value of a Fibonacci series using recursion in C#?
Create a method to get the nth value with recursion.public int displayFibonacci(int n)Call the method −displayFibonacci(val)On calling, the displayFibonacci() meyhod gets called and calculate the nth value using recursion.public int displayFibonacci(int n) { if (n == 0) { return 0; } if (n == 1) { return 1; } else { return displayFibonacci(n - 1) + displayFibonacci(n - 2); } }Let us see the complete code −Exampleusing System; public class Demo { public static void Main(string[] args) { Demo d = new ...
Read MoreCenter tabs in Bootstrap
Use the .nav-justified class in Bootstrap to center tabs in Bootstrap.You can try to run the following code to center tabs −Example Bootstrap Example Web Development The following are the web dev technologies: HTML5 jQuery JavaScript Ajax ES6
Read MoreC# program to separate joined strings in C#
The following is the string array −string[] str = { "Java", "AngularJS", "Python", "jQuery", "HTML5" };Firstly, join it −string.Join(" ", str);Now to separate the above joined strings, use the Split() method as shown in the following code −Exampleusing System; public class Demo { public static void Main() { string[] str = { "Java", "AngularJS", "Python", "jQuery", "HTML5" }; // join words string res = string.Join(" ", str); Console.WriteLine("Joined Strings... "+res); string[] convert = res.Split(' '); Console.WriteLine("Separate Joined Strings..."); foreach (string val in convert) { Console.WriteLine(val); } } }OutputJoined Strings... Java AngularJS Python jQuery HTML5 Separate Joined Strings... Java AngularJS Python jQuery HTML5
Read MoreInteger literals vs Floating point literals in C#
Integer LiteralsAn integer literal can be a decimal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, and there is no prefix id for decimal. Here are some of the examples of integer literals −10 // int 18u // unsigned intLet’s use the above literal while declaring and initializing a variable −// int int a =10;We will now print the values −Exampleusing System; namespace Demo { class Program { static void Main(string[] args) { // int int a =200; ...
Read MoreDefault value of bool in C#
Use the default operator to get the default value of bool type −bool a = default(bool);Above, we have used the default keyword to get the default value.Let us see the code to display default value of bool −Exampleusing System; public class Demo { public static void Main() { bool a = default(bool); // default for bool Console.WriteLine("Default for bool type = "+a); } }OutputThe following is the output. It shows a blank space i.e. False.Default for bool type = False
Read More