Why is there no overload of Interlocked.Add that accepts Doubles as parameters?

Others have addressed the “why?”. It is easy however to roll your own Add(ref double, double), using the CompareExchange primitive: public static double Add(ref double location1, double value) { double newCurrentValue = location1; // non-volatile read, so may be stale while (true) { double currentValue = newCurrentValue; double newValue = currentValue + value; newCurrentValue = … Read more

List(of String) or Array or ArrayList

List(Of String) will handle that, mostly – though you need to either use AddRange to add a collection of items, or Add to add one at a time: lstOfString.Add(String1) lstOfString.Add(String2) lstOfString.Add(String3) lstOfString.Add(String4) If you’re adding known values, as you show, a good option is to use something like: Dim inputs() As String = { “some … Read more

How to generate OAuth 2 Client Id and Secret

As section 2.2 of The OAuth 2.0 Authorization Framework says: The authorization server issues the registered client a client identifier — a unique string representing the registration information provided by the client. The client identifier is not a secret; it is exposed to the resource owner and MUST NOT be used alone for client authentication. … Read more

Is there any way to get the file extension from a URL

It is weird, but it works: string url = @”http://example.com/file.jpg”; string ext = System.IO.Path.GetExtension(url); MessageBox.Show(this, ext); but as crono remarked below, it will not work with parameters: string url = @”http://example.com/file.jpg?par=x”; string ext = System.IO.Path.GetExtension(url); MessageBox.Show(this, ext); result: “.jpg?par=x”

Static Method implementation in VB.NET

A VB.NET module is a static class. The compiler handles this for you. Every method and property on it is static (Shared). A class with a static (Shared) member on it is exactly that: a class with a static (Shared) member. You don’t have to create an instance of it to access the static (Shared) … Read more