Why can't an out parameter have a default value?
问题 Currently when trying to do something in a method that takes an out parameter, I need to assign the value of the out parameter in the method body, e.g. public static void TryDoSomething(int value, out bool itWorkerd) { itWorkerd = true; if (someFavourableCondition) { // if I didn't assign itWorked variable before this point, // I get an error: "Parameter itWorked must be assigned upon exit. return; } // try to do thing itWorkerd = // success of attempt to do thing } I'd like to be able to set