I write code without understanding WHY I can access constant values in static methods.
Why is it possible to access values constwithout declaring it as static?
For example.) This right to name IMAGE_FILE_EXTENSIONwithinAddImageToDocument(...)
public abstract class ImageDocumentReplacer : DocumentReplacer
{
private const string IMAGE_FILE_EXTENSION = ".tif";
private static void AddImageToDocument(int documentId, string separatedPath)
{
Console.WriteLine(IMAGE_FILE_EXTENSION);
}
}
source
share