Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by CharlieDigital

23 days ago

C# `out` is kinda nice because it can be `var`d and used directly.

2 comments

CharlieDigital

Reply

troupo  23 days ago

Erm... what do you mean?

  • metaltyphoon  23 days ago

      if (int.TryParse(str, out var value) && value == 5)
      {
          // value is available 
      }
    
       // value also available

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities