When using using static
you now need to know properties and methods without preceding with the namespace/class. It's okay if you know the properties and methods e.g.
Example 1, a method coded as static,
using System.Text.RegularExpressions;
namespace IncrementSequenceConsole.Classes
{
public class Helpers
{
public static string NextValue(string sender)
{
string value = Regex.Match(sender, "[0-9]+$").Value;
return sender[..^value.Length] + (long.Parse(value) + 1)
.ToString().PadLeft(value.Length, '0');
}
}
}
Usage
using System;
using System.Runtime.CompilerServices;
using IncrementSequenceConsole.Classes;
namespace IncrementSequenceConsole
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine($" F1124 {Helpers.NextValue("F1124")}");
Console.WriteLine($" 1278-120 {Helpers.NextValue("1278-120")}");
Console.WriteLine($" F102 {Helpers.NextValue("F102")}");
Console.WriteLine($"3999/IKL/VII/21 {Helpers.NextValue("3999/IKL/VII/21")}");
Console.ReadLine();
}
}
}
Example 2 with static
using System;
using System.Runtime.CompilerServices;
using static IncrementSequenceConsole.Classes.Helpers;
namespace IncrementSequenceConsole
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine($" F1124 {NextValue("F1124")}");
Console.WriteLine($" 1278-120 {NextValue("1278-120")}");
Console.WriteLine($" F102 {NextValue("F102")}");
Console.WriteLine($"3999/IKL/VII/21 {NextValue("3999/IKL/VII/21")}");
Console.ReadLine();
}
}
}
If I add additional methods or properties I know them unlike say Math where I may not know all methods thus making it more difficult to find them.
With that I'd go with an alias.
using System;
using System.Runtime.CompilerServices;
using H = IncrementSequenceConsole.Classes.Helpers;
namespace IncrementSequenceConsole
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine($" F1124 {H.NextValue("F1124")}");
Console.WriteLine($" 1278-120 {H.NextValue("1278-120")}");
Console.WriteLine($" F102 {H.NextValue("F102")}");
Console.WriteLine($"3999/IKL/VII/21 {H.NextValue("3999/IKL/VII/21")}");
Console.ReadLine();
}
}
}
My style of coding it's extremely rare to have a reason to instantiate an instance of a class of my own but when doing so side with aliasing.