RED
RED

Reputation: 1

Nullable reference types C#

I am trying to use code from classes in a console program in classes for a forms program so our project can have a working GUI and that console program used nullable reference types. how can i bypass this so i get the same functionality?

    static private Radio? _radio;

enter image description here solution explorer

Upvotes: 0

Views: 132

Answers (1)

Prasad Telkikar
Prasad Telkikar

Reputation: 16079

You have to update .csproj file to support C# 8.0 version and enable nullable option,

  <PropertyGroup>
    <LangVersion>8.0</LangVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>

How to edit .csproj file?

  • Right click on GUI Version 1 project -> Click on Edit Project file -> Update file with above two tags -> Reload project.

enter image description here

Alternate way:

  • Right click on GUI Version 1 project -> unload project -> Edit project File -> Update file -> Reload project.

enter image description here

Note: Image and GIF content is just for demo purpose, .csproj content will be different for you

Upvotes: 3

Related Questions