Hacker News new | past | comments | ask | show | jobs | submit login

I think Scott updated the sample used for the screenshots after putting it in the post.

The code is listed as:

  // FIRA CODE
  object o; 
  if (o is int i || (o is string s && 
      int.TryParse(s, out i)) { /* use i */ }
  var x = 0xABCDEF;
  -> --> ==> != === !== && ||<=<  
  </><tag> http://www.hanselman.com 
  <=><!-- HTML Comment -->
  i++; #### ***
I think what was actually used is:

  // FIRA CODE
  ABCDEFGHIJKLMNOPQRSTUVWXYZ
  0123456789!@#$%^&*()_+={}[]<>/?'";:~`
  object o; 
  if (o is int i || (o is string s && 
      int.TryParse(s, out i)) { /* use i */ }
  var x = 0xAB_DE_F;
  -> --> ==> != === !== && ||<=<  
  </><tag> http://www.hanselman.com 
  <=><!-- HTML Comment -->
  i++; #### ***
The underscores in the hex literal are not part of the font, which looks like it is confusing some people.

A couple of those lines are new C# 7 features (patterns and literals) that appear to have been partially lifted from this blog post: https://blogs.msdn.microsoft.com/dotnet/2017/03/09/new-featu...

I wrote a section on C# 7 for a new chapter in the upcoming second edition of my book from last year. There are loads of useful new features in C# 7 (and 6 if you're still on 5) and I thought I recognised those snippets.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: