Articles on Trending Technologies

Technical articles with clear explanations and examples

How to print a line on the console using C#?

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 794 Views

To display a line, Console.Write() is used in C#.Console displays the result on the console. I have first set a string.string str = "Tom Hanks is an actor";Now displaying the above line.Console.WriteLine(str);The following is the complete code −Exampleusing System; namespace Program {    public class Demo {       public static void Main(String[] args) {          string str = "Tom Hanks is an actor";          Console.WriteLine("Displaying a line below");          Console.WriteLine(str);          Console.ReadLine();       }    } }OutputDisplaying a line below Tom Hanks is an actor

Read More

Union Method in C#

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 949 Views

The Union method gets the unique elements from both the lists.Let us set two lists −var list1 = new List{12, 65, 88, 45}; var list2 = new List{40, 34, 65};Now get the union of both the lists −var res = list1.Union(list2);The following is the example −Exampleusing System.Collections.Generic; using System.Linq; using System; public class Demo {    public static void Main() {       // two lists       var list1 = new List{12, 65, 88, 45};       var list2 = new List{40, 34, 65};       // finding union       var res = list1.Union(list2);       foreach(int i in res) {          Console.WriteLine(i);       }    } }Output12 65 88 45 40 34

Read More

C# Queryable LongCount Method

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 216 Views

Use the Linq LongCount method to get the count of elements.The following is our string array −string[] emp = { "Jack", "Mark"};Now, use the LongCount() method.emp.AsQueryable().LongCount();Here is the complete code.Exampleusing System; using System.Collections.Generic; using System.Linq; class Demo {    static void Main() {       string[] emp = { "Jack", "Mark"};       long res = emp.AsQueryable().LongCount();       Console.WriteLine("{0} employees in the Department", res);    } }Output2 employees in the Department

Read More

How to declare a two-dimensional array in C#

George John
George John
Updated on 11-Mar-2026 892 Views

A 2-dimensional array is a list of one-dimensional arrays. Declare it like the two dimensional array shown below −int [, ] aTwo-dimensional arrays may be initialized by specifying bracketed values for each row.int [, ] a = new int [4, 4] { {0, 1, 2, 3} , {4, 5, 6, 7} , {8, 9, 10, 11} , {12, 13, 14, 15} };The following is an example showing how to work with two-dimensional arrays in C# −Exampleusing System; namespace ArrayApplication {    class MyArray {       static void Main(string[] args) {          /* an array ...

Read More

Why is f required while declaring floats in C#?

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 848 Views

The f is a lowercase suffix set while declaring a float. It tells the compiler that the literal is of a specific type.Exampleusing System.IO; using System; public class Program {    public static void Main() {       float val = 30.22f;       Console.WriteLine(val);    } }Output30.22Above, we have set the float using f suffix.IEnumerable res = val1.AsQueryable().Intersect(val2);

Read More

Add sizes for Bootstrap Buttons

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 305 Views

To add size for buttons in Bootstrap, try the following classes:ClassDescription.btn-lgThis makes the button size large..btn-smThis makes the button size small..btn-xsThis makes the button size extra small..btn-blockThis creates block level buttons—those that span the full width of a parent.ExampleYou can try to run the following code to create a small button −           Bootstrap Example                                                  Small button          

Read More

Bootstrap progress class

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 235 Views

Use the .progress class in Bootstrap to create a progress bar. The class is a container for progress bars.You can try to run the following code to implement progress class in BootstrapExample           Bootstrap Example                                                       90% Complete                    

Read More

What does the keyword var do in C#?

Samual Sam
Samual Sam
Updated on 11-Mar-2026 486 Views

The "var" keyword initializes variables with var support. Just assign whatever value you want for the variable, integer, string, float, etc.Exampleusing System; namespace Demo {    class Program {       static void Main(string[] args) {          var myInt = 5;          var myString = "Amit";          Console.WriteLine("Rank: {0} Name: {1}",myInt,myString);       }    } }OutputRank: 5 Name: AmitWe can also use var in arrays −Exampleusing System; namespace Demo {    class Program {       static void Main(string[] args) {          var myInt = new int[] {65,43,88,56};          foreach(var val in myInt)          Console.WriteLine(val);       }    } }Output65 43 88 56

Read More

C# program to get max occurred character in a String

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 904 Views

To get the maximum occurred character in a string, loop until the length of the given string and find the occurrence.With that, set a new array to calculate −for (int i = 0; i < s.Length; i++)    a[s[i]]++; }The values we used above −String s = "livelife!"; int[] a = new int[maxCHARS];Now display the character and the occurrence −for (int i = 0; i < maxCHARS; i++)    if (a[i] > 1) {       Console.WriteLine("Character " + (char) i);       Console.WriteLine("Occurrence = " + a[i] + " times");    }Let us see the complete code ...

Read More

Bootstrap .btn-block class

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 479 Views

To create a button using the .btn-block class, you can try to run the following code −Example           Bootstrap Example                                       The following are block level buttons:                Block level Primary button                      Block level button          

Read More
Showing 10471–10480 of 61,248 articles
Advertisements