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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:23:58+00:00 2026-05-31T11:23:58+00:00

I was wondering if there is a way to declare a method (in an

  • 0

I was wondering if there is a way to declare a method (in an interface for example) that supports the use of IEnumerator and Void, without the need to implement both in the subclasses?

public void Start()
public IEnumerator Start()

this is related to my other question: Hold or Wait while Coroutine finishes

i noticed in the Unity context, the default Start() method seems to allow for both.

  • 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-31T11:23:59+00:00Added an answer on May 31, 2026 at 11:23 am

    You can’t do that because those methods would have the same signature and the CSC woudn’t be able to figure out which method should be statically bound for each call. e.g.:

    public class TestClass
    {
        public int FooMethod()
        {
            return 1;
        }
        public void FooMethod()
        {
            return;
        }
        public string FooMethod()
        {
            return "foo";
        }
    }
    
    static void Main()
    {
        TestClass test = new TestClass();
    
        Console.WriteLine(test.FooMethod()); // which FooMethod should be called here?
    }
    

    A method’s return type is not considered as part of its signature. What you can do is overload the same method with a different signature to return a different type. Also, in the case of an additional method that differs only in returning void, you can always choose not to use the result returned by the original method.

    The case with interfaces is similar. when a class implements an interface it is agreeing to a protocol, that it implements that interface’s behaviour which is what consumers of your class expect. So you cannot partly agree with an interface. Although you can throw a NotImplementedException in your implementations you have to at least define all members, which leads to the same problem mentioned in the above example: the C# compiler will not be able to statically bind your method calls and your code will fail to compile.

    You can solve your problem by reconsidering your design.

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

Sidebar

Related Questions

I'm wondering if there is a way to declare routes in MVC3 so that
I was wondering is there a way in PHP that you could tell where
Wondering if there is any way to get the lambda expressions that result from
I was wondering if there is a way to declare an object in c++
I am wondering if there is any way to declare a byte variable in
I am wondering is there a way to render a partial view in the
I am wondering is there any way we can test the font size/color of
I am wondering is there any way to execute following shell script, which waits
Just wondering if there is any way to get the NS records in C#.
Just wondering if there is a way in Spring to have a parent controller:

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.