About 376,000,000 results
Open links in new tab
  1. out keyword - C# reference | Microsoft Learn

    Mar 30, 2024 · out (C# Reference) You can use the out keyword in two contexts: As a parameter modifier, which lets you pass an argument to a method by reference rather than by value. In generic …

  2. Out Parameter With Examples in C# - GeeksforGeeks

    Jul 11, 2025 · Multiple out Parameters: In C#, a user is allowed to pass multiple out parameters to the method and the method returns multiple values. Example: In the below code, we declared two value …

  3. Which is better, return value or out parameter? - Stack Overflow

    Please avoid using out parameters. Although, they can make sense in certain situations (for example when implementing the Try-Parse Pattern), they are very hard to grasp.

  4. ref vs out in C# - C# Corner

    Explore the distinction between 'ref' and 'out' keywords in C#. Learn how 'ref' passes arguments by reference for both input and output, while 'out' is used solely for output parameters, aiding in flexible …

  5. Mastering C# Fundamentals: the `out` Keyword - DEV Community

    Sep 29, 2024 · The out keyword allows passing parameters by reference in C#. Unlike the ref keyword, the out keyword doesn't require the argument to be initialized before passing it to a method.

  6. c# - out var _ and out _ difference? - Stack Overflow

    Feb 15, 2018 · The reason for this is that out _ already had a meaning, and the language maintains backward compatibility with that old meaning. But out typename identifier is new syntax in C# 7, so …

  7. out keyword (generic modifier) - C# reference | Microsoft Learn

    Sep 15, 2021 · For generic type parameters, the out keyword specifies that the type parameter is covariant. You can use the out keyword in generic interfaces and delegates. Covariance enables you …

  8. Difference between Ref and Out keywords in C# - GeeksforGeeks

    Jul 11, 2025 · The out is a keyword in C# which is used for the passing the arguments to methods as a reference type. It is generally used when a method returns multiple values.

  9. When should I use out parameters? - Stack Overflow

    Jul 23, 2009 · Setting an out parameter before exiting a method is required. If you want a value to be unchanged in some cases, use ref instead of out. The out parameter just saves the caller from …

  10. How to explicitly discard an out argument? - Stack Overflow

    Mar 21, 2018 · You used the word "dispose" in the question, which I suspect was just unfortunate - but if the out parameter is of a type which implements IDisposable, you should certainly call Dispose …