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 8481633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:36:33+00:00 2026-06-10T19:36:33+00:00

Are these the same? public void MyMethod() {do something} public MyMethod() {do something} void

  • 0

Are these the same?

public void MyMethod() {do something}

public MyMethod() {do something}

void means return nothing – so leaving this key word out also means return nothing? If this is the case then why does the word exist in the language – is it used in other situations?

  • 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-06-10T19:36:35+00:00Added an answer on June 10, 2026 at 7:36 pm

    Your second option doesn’t compile.

    C# specs requires that every method returns a type also when there is no result to return.

    Methods are declared within a class or struct by specifying the access level,
    the return value, the name of the method, and any method parameters. …

    As noted by others the exception are class constructors.

    Methods (C# Programming Guide) on MSDN.

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

Sidebar

Related Questions

So these two methods have the same signature but different constraints public static void
What is the difference between these method signatures? public void T MyMethod<T>(T parameter) and
These two methods appear to behave the same to me public IEnumerable<string> GetNothing() {
I have this code: public void FileCleanup(List<string>paths) { string regPattern = (@[~#&!%+{}]+); string replacement
I have this unit test: [Test] public void ProcessDbFile_should_delete_file_if_it_exists_then_copy_new_file_to_same_location() { // used to create
So say I'm doing TDD and I write a test like this: public void
I have this class : package scripts; public class TestStatic { public static void
I have the following code: public static MyMethod() { ...Do something ProtectedMethod(param1, param2); ...Do
What is the difference? Are these the same? If not, can someone please give
P&G P&ampG P&amp;G All these are same. Is the use of special entities only

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.