Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to get generic type #29

Closed
cipri7329 opened this issue Apr 30, 2015 · 0 comments
Closed

Fail to get generic type #29

cipri7329 opened this issue Apr 30, 2015 · 0 comments

Comments

@cipri7329
Copy link

I have the following class:

    public class MyGenericArray<T>
    {
        private T[] array;

        public MyGenericArray(int size)
        {
            array = new T[size + 1];
        }

        public T getItem(int index)
        {
            var in2 = index + 1;
            in2 = index - in2;
            index = index + 1 - in2 - 1;
            return array[index];
        }
    }

I use dnlib to make some changes at the cil code level.
Inside the getItem() method, I want to get the class type of the this parameter, ldarg.0
I am looking in the param.Type where
var param = ((Parameter)_instruction.Operand);

I have searched through all the available fields but I could not find it.
In fact, what I get is

ConsoleCalculator.BasicTests/MyGenericArray`1 

and I expect to find

ConsoleCalculator.BasicTests/MyGenericArray`1<!T> 

I don't understand why the <!T> is missing.
For the field private T[] array; the class is displayed correctly, with the <!T> at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant