Who favors the current D1 situation?

Julio César Carrascal Urquijo jcarrascal at gmail.com
Fri Mar 7 20:07:37 PST 2008


Bill Baxter wrote:
> What's the deal with const in C#?  Anyone care to give a summary?  I see 
> conflicting things in my googling.  Somethign about readonly objects, 
> but no const/readonly for parameters to functions?
> 
> --bb

The "const" keyword is only for value types. The "readonly" keyword can 
only be applied to (the reference of) instance variables. No const 
parameters and no const methods.

Const parameters are faked with read-only wrappers like 
List<T>.AsReadOnly().

Interestingly there's not that much pressure for const in C# as there's 
for const in Java.


-- 
Julio César Carrascal Urquijo
http://jcesar.artelogico.com/



More information about the Digitalmars-d mailing list