Sign in to follow this  
MrCSCUndergrad

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

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this