[C#] Null Reference & Reference Types in C# | Plus Nullable Data Types & The NullReferenceException

3
1



Today you’ll learn all about the Null literal and Null reference in C#

We’ll take a look at what a reference type is and find out what references are exactly. This is the standard Microsoft docs definition Ace. We also have a brief look at the differences between reference types and value types

Then I’ll explain what the ‘null’ literal is and discuss the ‘null’ reference. This features a look at the Null Reference Exception (NullReferenceException), an error you will see throughout your programming life Ace

After that we’ll see what a ‘null-coalescing operator’ (??) is. This is similar to the ternary operators we have seen before Ace, and I’ll give you a quick explanation of them

And finally we’ll touch upon Nullable types. Here I’ll give you the Microsoft docs explanation and show you examples with the ‘int?’ type. The Nullable type uses generics Ace, but we won’t be covering those in this video. I’ll also show you the ‘HasValue’ and ‘Value’ property of the type, and I’ll also show you the “InvalidOperationException: Nullable object must have a value”.

As always Ace, I want to thank you so much for your continued support, with your comments, ratings and subscriptions. It really means a lot to me and keeps me motivated to create these videos for you.

Enjoy 🙂

[ Info ]

Email ~ RetroTK2@gmail.com
Music ~ [Lensko – Heaven]
Subscribe ~

Share Video ~

Channel Files Git ~

Channel Files ~

Nguồn:https://wijstaanvooronzegrondrechten.org/

3 COMMENTS

  1. using Lice.Data.Interfaces;

    using Microsoft.AspNetCore.Mvc;

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Threading.Tasks;

    namespace Lice.Controllers

    {

    public class EchipamentController :Controller

    {

    private ICategoryRepository categoryRepository;

    private IEchipamentRepository echipamentRepository;

    private readonly ICategoryRepository _categoryRepository;

    private readonly IEchipamentRepository _echipamentRepository;

    public EchipamentController()

    {

    _categoryRepository = categoryRepository;

    _echipamentRepository = echipamentRepository;

    }

    public ViewResult List()

    {

    var echipamente = _echipamentRepository.Echipamente;
    //HERE IS THE ERROR

    return View(echipamente);

    }

    }

    }

    okk soo…my error is there. Can you please tell me what can I do to solve it??

LEAVE A REPLY

Please enter your comment!
Please enter your name here