Visual Studio IDE Helper/Summary - Reference name of passed object through constructor.

Hello,

I have an example script below, something that is generic as to avoid creating many classes that only ever store two properties. However when working with multiple instances, all the .x .y etc references get a bit harder to track. Especially when re-visiting a project.

I am wondering if it is possible to add some kind of helper in the IDE. Something that will add a summary when hovering over one of the variable fields, which references the name of the object that was passed through the public constructor.

For example, if instantiating Example(id, someObject). When typing object dot ‘x’, there will be a summary with the name ‘ID’. And ‘someObject’ with dot ‘y’.

    class Example<X, Y>
    {
        public X x;
        public Y y;

        public Example(X x, Y y)
        {
            this.x = x;
            this.y = y;
        }
    }

Is something like this possible?
Or is it just general bad practice to create generic style objects?

Thank you in advance :slight_smile:

With iOS and Android and other AOT compilation targets, effectively you still ARE creating those classes, it’s just done for you behind the scenes, at least AFAIK.

Personally I try to a) write as little code as possible, and yet b) make each piece of code extremely clear what it is for and what it does.

The former is because lines of code NOT written cannot have bugs.

The latter is because tomorrow I will already have forgotten what I was doing and need the memory-jog of a good classname and method name.

I rename my stuff ALL the time to keep it up to date and relevant.