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

  • SEARCH
  • Home
  • 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 6047075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:18:41+00:00 2026-05-23T07:18:41+00:00

Possible Duplicate: What is System.Void? I have no practical reason for knowing this answer,

  • 0

Possible Duplicate:
What is System.Void?

I have no practical reason for knowing this answer, but I’m curious anyway…

In C#, trying to use System.Void will produce a compilation error:

error CS0673: System.Void cannot be used from C# — use typeof(void) to get the void type object

As I understood it, void is simply an alias of System.Void. So, I don’t understand why ‘System.Void’ can’t be used directly as you might with ‘string’ for ‘System.String’ for example. I would love to read an explanation for this!

Incidentally, System.Void can be successfully used with the Mono compiler, instead of Microsoft’s, and there it appears equivalent to using the void keyword. This must therefore be a compiler-enforced restriction rather than a CLR restriction, right?

  • 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. Editorial Team
    Editorial Team
    2026-05-23T07:18:42+00:00Added an answer on May 23, 2026 at 7:18 am

    I believe the sole purpose for this struct is to use it in reflection, whereas the other types (like System.String, System.Int32 etc.) are proper types holding data. System.Void carries no data and you cannot instantiate this struct from your code.

    My guess about the compiler error is that it’s there to enforce consistency in code. It would look weird to have methods like this:

    System.Void MyMethod() { ... }
    

    At first glance, it appears to be returning something while in reality it doesn’t. In my opinion, this is a good decision by the C# team (if my speculation about it is correct)

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

Sidebar

Related Questions

Possible Duplicate: Should I use static_cast or reinterpret_cast when casting a void* to whatever
Possible Duplicate: Choosing between MEF and MAF (System.AddIn) Is the Managed Extensibility Framework a
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: C# Update Table using SqlCommand.Parameters I'm trying to update an SQL Server
Possible Duplicate: How to invalidate the file system cache? In order to be able
Possible Duplicate: 'Contains()' workaround using Linq to Entities? I am using the System.Linq.Dynamic library
Possible Duplicate: Why does this conversion doesn't work? Hi, i discovered a strange behaviour
I know its probably possible, but is it practical and doable to try and

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.