I have an object that I work with, and it is placed within a lot of dictionaries and lists, so when I call it, the line gets really long, and I would like to be able to just do some things quickly using its reference, like so:
ref MyObject o = thingsStorageClass.dictionary[anotherDictionary[list.key]];
o.someField = value;
int i = o.integer;
DoStuff(o.specialSomething);
But it seems I can’t just place ref before a local object initialization. How do I do something like this without using an external method with my object as parameter?
Just remove
refand it will work, becauseois an instance of classMyObject, so it is reference type. You won’t create new instance this way.