Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Mark Quennell

@Mark Quennell
About
Posts
6
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • OOP and the scope of a class, am I wrong?
    M Mark Quennell

    I guess that could be considered a class in a command-based architecture, where ReadTextFile inherits from (or implements) some sort of base Command class and it contains all the information the processing system needs to perform that action, but it's a stretch, and certainly not to be taught as "the norm"...

    The Lounge design com graphics iot question

  • Really uSoft?
    M Mark Quennell

    Other than now using 64-bit, isn't that all VS2022 preview has changed so far?

    The Lounge css visual-studio com question announcement

  • C Sharps - how are you getting on with nullable reference types?
    M Mark Quennell

    Yeah, the Value and HasValue properties are possible for nullable value types, because they are implemented by wrapping the value type in a `Nullable`. Nullable reference types is just a compiler warning wave telling you when a reference type is null and shouldn't be, etc. The thing to remember is that StreamReader#ReadLine could always return null. The difference is that it now makes it clear by telling you "I return string?", as opposed to returning string and you not realising.

    The Lounge csharp com performance help tutorial

  • C Sharps - how are you getting on with nullable reference types?
    M Mark Quennell

    It depends on which version of C# you're using. In NET5 (or maybe even Core3.1), StreamReader#ReadLine does return string?. All of the core library is now annotated with ? and attributes which assist the NRT parser. You'll find this a lot in reflection and other methods which used to potentially return null.

    The Lounge csharp com performance help tutorial

  • C Sharps - how are you getting on with nullable reference types?
    M Mark Quennell

    Bear in mind that this is a compiler-only thing - once compiled, all strings are back to being normally nullable. If you have function declaration: `void M(string s) { }`, the idea is that you can be assured that `s` is going to be a not-null string. Because, where you call that function, you will be warned if you try `M(null)`, or ``` string? s; M(s); ``` The only times you are expected to test for null are: 1) If you receive a string? from a function. You should check for non-null before you use it. 2) Even if you have a not-null string parameter, if that method is external facing, another project may still send a null string (obviously this all works for any reference type, not just strings...) Does that help?

    The Lounge csharp com performance help tutorial

  • C Sharps - how are you getting on with nullable reference types?
    M Mark Quennell

    The way I see it, if you've turned on NRT, haven't got any strings with ? at the end, and no compiler errors, you're doing well :-) I use NRT all the time, since it was in the prototype stages, and I love it. The ability for the compiler to warn when you're accidentally using something that is potentially null is really useful. Especially things that you didn't previously realise could return null!

    The Lounge csharp com performance help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups