Hello
Well i want to declare an array as read only so once initialized we cant change it ..
like ReadOnly int [] arr ={1,2,3,4,5};
is it possible like this ???? if not please provide remedy
Thank you
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jul 15, 2013, 9:29 AM EDT
For example:
SUNIL GUTTARank #1,832 · 810 reputationPosted Jul 15, 2013, 9:51 AM EDT
TY
VulpesRank #55 · 29.2K reputationPosted Jul 15, 2013, 10:28 AM EDT
All you can do is to copy them back out to an array again and then sort that:
You could wrap the sorted array again in a ReadOnlyCollection but it would, of course, be a different object to the one that was used originally.