Services doubt about implementation with an interface or without?

services.AddSingleton<IRestaurantData,InMemoryRestaurantData>(); VS services.AddSingleton<InMemoryRestaurantData>(); ​ Both implementation are working, but where is the advantage to use an interface as implementation together with the class? This is the constructor where it will be passed inside private readonly IRestaurantData _restaurantData; public ListModel( IRestaurantData restaurantData) { _restaurantData = restaurantData; } VS private readonly InMemoryRestaurantData _restaurantData; public ListModel( InMemoryRestaurantData restaurantData) […]

Generation images

I’m trying to make a winforms application to write text and place images in a specific location on a image. Sort of basically draw text and image on a template. For now the method I have been using is placing a panel and a image box and a table with text and it worked great […]

Questions about optional/ default parameters.

I’m learning C# and I’ve ran into a but if an issue. I have the following code “`public static void Main(string[] args) { Console.WriteLine(“You entered the number {0}.”,GetByte(“Please Enter a Number:n”, , 6)); //MainMenu(); } public static byte GetByte(string pText = “”,bool pRepeatPrint = false,byte pMin = Byte.MinValue,byte pMax = Byte.MaxValue) { bool invalidInput = […]