Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 86929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:19:23+00:00 2026-05-10T22:19:23+00:00

I ran across this and was wondering if someone could explain why this works

  • 0

I ran across this and was wondering if someone could explain why this works in VB.NET when I would expect it should fail, just like it does in C#

//The C# Version  struct Person {     public string name; } ... Person someone = null; //Nope! Can't do that!! Person? someoneElse = null; //No problem, just like expected 

But then in VB.NET…

Structure Person     Public name As String End Structure ... Dim someone As Person = Nothing 'Wha? this is okay? 

Is Nothing not the same as null (Nothing != null – LOL?), or is this just different ways of handling the same situation between the two languages?

Why or what is handled differently between the two that makes this okay in one, but not the other?

[Update]

Given some of the comments, I messed with this a bit more… it seems as if you actually have to use Nullable if you want to allow something to be null in VB.NET… so for example…

'This is false - It is still a person' Dim someone As Person = Nothing Dim isSomeoneNull As Boolean = someone.Equals(Nothing) 'false'  'This is true - the result is actually nullable now' Dim someoneElse As Nullable(Of Person) = Nothing Dim isSomeoneElseNull As Boolean = someoneElse.Equals(Nothing) 'true' 

Too weird…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:19:24+00:00Added an answer on May 10, 2026 at 10:19 pm

    If I remember correctly, ‘Nothing’ in VB means ‘the default value’. For a value type, that’s the default value, for a reference type, that would be null. Thus, assigning nothing to a struct, is no problem at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Ask A Question

Stats

  • Questions 58k
  • Answers 58k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I have amended your code and produced a working example.… May 11, 2026 at 8:53 am
  • added an answer At the simplest level: when you call ServiceBase.Run, you get… May 11, 2026 at 8:53 am
  • added an answer We are not currently using the Archive storage engine, but… May 11, 2026 at 8:53 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.