Articles on Trending Technologies

Technical articles with clear explanations and examples

Time Functions in C#

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

The DateTime has methods and properties for Date and Time as well like how to get the number of hours or minutes of a day, etc.Let us only focus on the time functions −Refer MSDN (Microsoft Developer Network) for all the functions −Sr.No.Method & Properties1AddDays(Double)Returns a new DateTime that adds the specified number of days to the value of this instance.2AddHours(Double)Returns a new DateTime that adds the specified number of hours to the value of this instance.3AddMilliseconds(Double)Returns a new DateTime that adds the specified number of milliseconds to the value of this instance.4AddMinutes(Double)Returns a new DateTime that adds the specified ...

Read More

Use dropdowns with any button size using Bootstrap

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

Use btn-large, .btn-sm, or .btn-xs class to use dropdowns with any button size.Let us see an example of btn-largeExample           Bootstrap Example                                                       Default                                                 Action             Another action             Something else here                         Separated link                    

Read More

Set important information for a list item in a list group with Bootstrap

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

use the list-group-item-info class in Bootstrap to set key information for a list item in a list group.You can try to run the following code to implement the list-group-item-info class −Example           Bootstrap Example                                          Java                                      Interfaces                                        Multi-threading                                        Packages                                

Read More

How to display Absolute value of a number in C#?

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 3K+ Views

To find the absolute value of a number in C#, use the Math.Abs method.Set numbers first −int val1 = 77; int val2 = -88;Now take two new variables and get the Absolute value of the above two numbers −int abs1 = Math.Abs(val1); int abs2 = Math.Abs(val2);Let us see the complete code to display Absolute value of a number −Exampleusing System; class Program {    static void Main() {       int val1 = 77;       int val2 = -88;       Console.WriteLine("Before...");       Console.WriteLine(val1);       Console.WriteLine(val2);       int ...

Read More

C# program to remove all duplicates words from a given sentence

George John
George John
Updated on 11-Mar-2026 1K+ Views

Set a string with duplicate words.string str = "One Two Three One";Above, you can see the word “One” comes twice.To remove dulicate words, you can try to run the following code in C# −Exampleusing System; using System.Linq; public class Program {    public static void Main() {       string str = "One Two Three One";       string[] arr = str.Split(' ');       Console.WriteLine(str);       var a =       from k in arr       orderby k       select k;       Console.WriteLine("After removing duplicate words...");   ...

Read More

Scope of Variables in C#

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

The scope of a variable is a region of code that indicates where the variables are being accessed.For a variable, it has the following levels −Method LevelVariable declared inside a method is a local variable.Class LevelVariable declared inside a class is a local variable are class member variables.Let us see an example of scope of variables −Exampleusing System; namespace Demo {    class Program {       public int Divide(int num1, int num2) {          // local variable in a method          int result;          result = num1 / ...

Read More

Nest button groups with Bootstrap

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

Nest button groups within another button group i.e, place a .btn-group within another .btn-group. This is done when you want dropdown menus mixed with a series of buttons.To nest button groups, you can try to run the following code −Example           Bootstrap Example                                          Rank          Marks                                      Subjects                                                        Maths                Science                English                                

Read More

Map function and Lambda expression in Python to replace characters

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

We want to replace a character a1 with a character a2 and a2 with a1. For example, For the input string, "puporials toinp"and characters p and t, we want the end string to look like −"tutorials point"For this we can use map function and lambdas to make the replacement. The map(lambda, input) function iterates over each item passed to it(in form of iterable input) and apply the lambda expression to it. So we can use it as follows −Exampledef replaceUsingMapAndLambda(sent, a1, a2): # We create a lambda that only works if we input a1 or a2 and swaps them. newSent ...

Read More

C# Program to replace a special character from a String

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 6K+ Views

Let’s say our string is −string str = "abcd$ef$gh";To replace the special character, use the Replace() method.string res = str.Replace('$', 'k');The following is the complete code to replace character from a string −Exampleusing System; public class Program {    public static void Main() {       string str = "abcd$ef$gh";       Console.WriteLine("Initial string = " + str);       string res = str.Replace('$', 'k');       // after replacing       Console.WriteLine("Replaced string = " + res.ToString());    } }OutputInitial string = abcd$ef$gh Replaced string = abcdkefkgh

Read More

How to clear screen using C#?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 12K+ Views

Use the Console.Clear() method to clear screen and the console buffer. When the Clear method is called, the cursor automatically scrolls to the top-left corner of the window.Here, we have cleared the screen and then set the ForegroundColor and BackgroundColor −ConsoleColor newForeColor = ConsoleColor.Blue; ConsoleColor newBackColor = ConsoleColor.Yellow;The following is the complete code −Exampleusing System; using System.Collections.Generic; class Program {    static void Main() {       ConsoleColor foreColor = Console.ForegroundColor;       ConsoleColor backColor = Console.BackgroundColor;       Console.WriteLine("Clearing the screen!");       Console.Clear();       ConsoleColor newForeColor = ConsoleColor.Blue;       ConsoleColor newBackColor = ConsoleColor.Yellow;    } }OutputClearing the screen!

Read More
Showing 9791–9800 of 61,248 articles
« Prev 1 978 979 980 981 982 6125 Next »
Advertisements