Question:
There is a static Helper
class. I want to use it from another form, but I have to call it via Helper.Val
. Is it possible to do something using Helper;
and then just call Helper
public static class Helper
{
public static double Val(string data)
{
return Convert.ToDouble(data.Replace(".", ","));
}
}
Answer:
You can here's how.
At the beginning of the file
using static YourNamespace.Helper;
and in code just
double v = Val(data);
(Note, not just using
, but using static
.)
Works starting from C# 6 (Visual Studio 2015).