Custom Components: Differences between GetData and GetData<T>

Hi everyone,
I have to read an input inside the SolveInstance method and I was wondering if there are any significant differences between the following methods:

        var inGHString = new GH_String();
        var text = string.Empty;

        //1)
        DA.GetData<GH_String>(++inputParameterIndex, ref inGHString);
        text = inGHString.Value;

        //2)
        DA.GetData(++inputParameterIndex, ref inGHString);
        text = inGHString.Value;

        //3)
        DA.GetData<string>(++inputParameterIndex, ref text);

        //4)
        DA.GetData(++inputParameterIndex, ref text);

I have used a string type just as an example.

There is no difference between 1 and 2, or indeed 3 and 4. Whether or not you include the generic type constraint specifically, the resulting compiled code is the same. Either the compiler can figure out on its own what the constraint is supposed to be based on contextual information, or you’ll get a compilation error.

There is however a difference between the GH_String and string approach. The data itself is stored as GH_String so getting that is fastest. On the other hand, you’re probably going to convert it to string anyway on your own so you may as well ask for string right away.

Typically I only ever bother with the GH_????? types inside components if I want to make sure the exact same instance is passed through the component, or if the GH_????? type has some information I care about, such as Rhino object reference IDs.

Ok, now it is very clear
Thank you!