public Item getItem(ulong itemId)
{
Item item = items[itemId]
return item;
}
Now the problem is: the callee of getItem
must be able to retrieve information that item
holds; but not modify it.
Sorry, but I know C++ better than C#... I'm afraid I must fall back to C++ for a teeny tiny while just to make myself clear what I'm trying to achieve... So this is what I'd do in C++ in this situation:
const Item& getItem(unsigned long itemId)
{
const Item& item = items[itemId];
return item;
}
Very well - now whoever called getItem
may call getters on item
, but not setters.
I need to achieve a similar result in C#... is it possible?