I am a little confused why this does not give an error. I found this code deep inside some outdated old software and was surprised to see it work.
public static string CleanFileName(this string fileName)
{
return CleanFileName(fileName, 64);
}
public static string CleanFileName(this string fileName, int maxLength)
{
}
My experience using extension methods is to call it like this:
fileName.CleanFileName(64);
Does this only work because it is also a static method? Is this a common practice and something that I have not yet seen, or a piece of legacy code that I have to kill with fire?
source
share