Articles on Trending Technologies

Technical articles with clear explanations and examples

String slicing in C# to rotate a string

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

Let’s say our string is −var str = "welcome";Use the substring() method and the following, if you want to rotate only some characters. Here, we are rotating only 2 characters −var res = str.Substring(1, str.Length - 1) + str.Substring(0, 2);The following is the complete code −Exampleusing System; public class Program {    public static void Main() {       var str = "welcome";       Console.WriteLine("Original String = "+str);       var res = str.Substring(1, str.Length - 1) + str.Substring(0, 2);       Console.WriteLine("Rotating two characters in the String: "+res);    } }OutputOriginal String = welcome Rotating two characters in the String: elcomewe

Read More

Add plain text next to a form label within a form with Bootstrap

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 11-Mar-2026 581 Views

To add plain text to a form label within a form, use the .form-control-static in Bootstrap.You can try to run the following code to implement a .form-control-static class in BootstrapExample           Bootstrap Example                                                       Email:                            amit@demo.com                                

Read More

String Formatting in C# to add padding

seetha
seetha
Updated on 11-Mar-2026 1K+ Views

With C#, you can easily format content and add padding to it.To add padding −const string format = "{0,-5} {1,5}";Now, add the padding to the strings −string str1 = string.Format(format, "Rank","Student"); string str2 = string.Format(format, "2","Tom");Let us see the complete code −Exampleusing System; using System.Collections.Generic; public class Program {    public static void Main() {       // set padding       const string format = "{0,-5} {1,5}";       string str1 = string.Format(format, "Rank","Student");       string str2 = string.Format(format, "2","Tom");       Console.WriteLine(str1);       Console.WriteLine(str2);    } }OutputRank Student 2 Tom

Read More

C# Program to filter array elements based on a predicate

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 3K+ Views

Set an array.int[] arr = { 40, 42, 12, 83, 75, 40, 95 };Use the Where clause and predicate to get elements above 50.IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50);Let us see the complete code −Exampleusing System; using System.Linq; using System.Collections.Generic; public class Demo {    public static void Main() {       int[] arr = { 40, 42, 12, 83, 75, 40, 95 };       Console.WriteLine("Array:");       foreach (int a in arr) {          Console.WriteLine(a);       }       // getting elements above 70       IEnumerable myQuery = arr.AsQueryable() .Where((a, index) => a >= 50);       Console.WriteLine("Elements above 50...:");       foreach (int res in myQuery) {          Console.WriteLine(res);       }    } }OutputArray: 40 42 12 83 75 40 95 Elements above 50...: 83 75 95

Read More

Bootstrap .checkbox-inline class

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

Use .checkbox-inline class to a series of checkboxes for controls to appear on the same line. You can try to run the following code to implement the .checkbox-inline classExample           Bootstrap Forms                                       Best IDE (You can select more than one)                             NetBeans IDE                                 Eclipse IDE                    

Read More

Container for form input and label with Bootstrap

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

Use the .form-group class in Bootstrap to set a container for form input and label &minusExample           Bootstrap Example                                                       Student Name                                          Upload Resume                        Example block-level help text here.                 Next          

Read More

How to use #error and #warning directives in C#?

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

#error directiveThe #error directive allows generating an error from a specific location in your code.Let us see an example −Exampleusing System; namespace Demo {    class Program {       public static void Main(string[] args) {          #if (!ONE)          #error ONE is undefined          #endif          Console.WriteLine("Generating a user-defined error!");       }    } }After running the above program, a user-defined error generates −OutputCompilation failed: 1 error(s), 0 warnings error CS1029: #error: 'ONE is undefined'#warning directiveThe #warning directive allows generating a level one ...

Read More

Convert.ToDecimal Method in C#

Samual Sam
Samual Sam
Updated on 11-Mar-2026 4K+ Views

Convert a specified value to a decimal number using the Convert.ToDecimal() method.We have a string here.string stringVal = "2,345.26";Now, let us use the Convert.ToDecimal() method to convert it to a decimal number.decimal decimalVal; decimalVal = System.Convert.ToDecimal(stringVal);Let us now see the complete example −Exampleusing System; public class Demo {    public static void Main() {       decimal decimalVal;       string stringVal = "2,345.26";       decimalVal = System.Convert.ToDecimal(stringVal);       System.Console.WriteLine("String converted to decimal = {0} ", decimalVal);    } }OutputString converted to decimal = 2345.26

Read More

Bootstrap .radio-inline class

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 1K+ Views

Use .radio-inline class to a series of radios for controls to appear on the same line. You can try to run the following code to implement the radio-inline class in Bootstrap −Example           Bootstrap Forms                                       Best Porgraming Language                             Java                                 C                                 C++                    

Read More

Make a <form> left-aligned with Bootstrap

Samual Sam
Samual Sam
Updated on 11-Mar-2026 3K+ Views

Use the .form-inline class in Bootstrap to make a left aligned.You can try to run the following code to implement .form-inline classExample           Bootstrap Example                                                       Name                                             Name                                Submit          

Read More
Showing 10481–10490 of 61,248 articles
Advertisements