• Advertisement
Sign in to follow this  

[.net] Function/parameter const-ness in C#.

This topic is 4643 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering if the C/C++ style const functions/function arguments were still valid in C#. None of the books I have read on C# have mentioned anything about this. Has it changed to the final keyword, does const still work, or does the .net code generator recognize functions that do not modify their object? I ask because I know that in C/C++ declaring member functions and/or arguments constant is one of the easiest ways to get the really good compiler optimizations working for you. Any insight or information would be greatly apreciated. Thanks in advance. ~Chris

Share this post


Link to post
Share on other sites
Advertisement
Const functions and parameters do not exist in C#.

What kind of optimization are you looking for?

Cheers

Share this post


Link to post
Share on other sites
Huh. That article was very interesting SamLowry. I guess that would explain why there is no function const-ness in C#. I may have been too trusting in the "all powerfull" globally optimizing compiler. :)

Thank you both.
~Chris

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement