Well, they aren't a bad idea I think. Dictionary<K, V> has a TryGetValue method which is a very good example why out parameters are sometimes a very nice thing to have.
You should not overuse this feature of course, but it's not a bad idea per definition. Especially not in C# where you have to write down the out keyword in function declaration and call which makes it obvious what's going on.
If you care about writing reliable code by embracing immutability and removing side effects, then out parameters are an absolutely terrible idea. It forces you to create mutable variables just to deal with them. (Not that C# supports readonly method-level variables anyway (at least in the version I'm using, 3.5)).
Secondly, they reduce the compositionality of functions by forcing the developer to set up and deal with the variables which receive the out values. This is annoying ceremony. You can't just go and compose expressions using them with anything resembling ease. Therefore code calling these functions quickly turns into a big imperative mess, providing lots of places for bugs to hide.
Well, there is no clear answer for this,but simple use case for out parameter would be Int.TryParse("1",out myInt)
The XXX.TryParse method job is, it converts a value of some type, to another type, it returns to you a boolean flag to indicate the conversion success or failure, which is one part the other part is the converted value, which is carried by the out parameter in that method.
This TryParse method was introduced in .NET 2.0 to get over the fact that XXX.Parse will throw an exception if the conversion fails and you had to put in try/catch around the statement to catch it.
So basically it depends on what your method is doing, and what the method callers are expecting, if you are doing a method that returns some form of response codes, then the out parameters could be use to carry out method returned results.
anyway Microsoft says "Avoid using out parameters", in their design guideline (MSDN page)
I would have to agree with GateKiller. I can't imagine out parameters being too bad if Microsoft used them as part of the base library. But, as with all things, best in moderation.
I think in some scenarios they are a good idea because they allow more than 1 object to be returned from a function for example:
DateTime NewDate = new DateTime();
if (DateTime.TryParse(UserInput, out NewDate) == false) {
NewDate = DateTime.Now;
}
Very useful :)