Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Nov 20, 2015 at 05:15 PM by mescalin for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by mescalin · Nov 20, 2015 at 02:08 PM · c#language

call the current method, using some sort of keyword? for self reference

Hi

Is there anyway i can call the current method from inside without typing the method name again (incase the method name is changed by someone else later)

So currently, i call the same name internally (SelfRef), this will cause a bug in future maintenance if not using a code auditing program

i.e.

 void SelfRef(string _Input){
         
         if (_Input == "route1"){
             
             //route1 calls route 2
             
             SelfRef("route2"); //call self
             
             
         }else if (_Input == "route2"){
             
             //route2 ends
         }
     }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Nov 20, 2015 at 02:17 PM 0
Share

Hmm dont know. $$anonymous$$akes me think of delegates, macros and function pointers.

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by wibble82 · Nov 20, 2015 at 02:41 PM

Hi there

I'm afraid there isn't that functionality as far as I know, though it's possible I've just not found it!

I would point out though that unless somebody changes the method name AND creates a new method with the original name, it'll just create an easily fixable compiler error - no need for using code auditing software or anything.

-Chris

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mescalin · Nov 21, 2015 at 12:14 AM 0
Share

thanks, sorry in the end the answer was f* bombed by stack exchange

http://stackoverflow.com/questions/33828287/c-sharp-self-reference-a-method?sfb=2

closing...

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to create my own programming language? 3 Answers

function based on return value 2 Answers

Save chosen language 1 Answer

Is Unity 5.2 uses mono 4? 0 Answers

Unity IOS Build Error: AssemblyResolutionException: Failed to resolve assembly: 'UnityEngine.CoreModule 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges