devxlogo

Recent

Trigger a GET Request via the JDK 11 HttpClient API

The JDK 11 HttpClient API is very flexible and intuitive. Here it is a sample of triggering a GET request and printing the response: HttpClient client = HttpClient.newHttpClient();HttpRequest request =

Check Whether an Input Argument Is Null in C#

Use this extension method in C# to check whether or not an input argument is null, and throw an error if necessary. Extension method: public static void CheckIfParameterIsValid(this T o,

Extension Method to Update All Items in a List

See how to use an extension method in C# to update all items in a list. public static IEnumerable ForEach(this IEnumerable collection, Action action){//Loop thru the collectionforeach (T item in

How Reverse a String in C#

See how to reverse a string. public static string ReverseString( string input) { char[] array = input.ToCharArray(); Array.Reverse(array); return new string(array); }Console.WriteLine(ReverseString(“devx”));