correction argument, not parameter.

On Wed, Dec 1, 2010 at 4:02 PM, Greg Young <[email protected]> wrote:

> I think there is some confusion here ...
>
> "Cecil, unlike say, System.Reflection, won't replace the
> GenericParameters in method signatures by their actual arguments. If
> you want to do so, you just have to visit the different parameter
> types or return type of the method, and if it's a GenericParameter,
> you can try to get its value (the argument) in the generic instance on
> which the method is declared."
>
> This will give me the generic parameter off the type its being called on.
> This does not appear to be what I want from looking through.
>
> interface IWhatever<T> { Something(T val) ; }
>
> public class A<TSomething> {
>     public IWhatever<TSomething> whatever;
>     public void Method() {
>          whatever.Something(default(TSomething));
>     }
> }
>
> I have the whatever.Something() call ... I want to figure out that T on it
> is actually the TSomething parameter from the enclosing class.
>
> Does this make sense?
>
> Greg
>
>
> On Tue, Nov 30, 2010 at 1:14 PM, Jb Evain <[email protected]> wrote:
>
>> Hi,
>>
>> On Tue, Nov 30, 2010 at 6:00 PM, Greg Young <[email protected]>
>> wrote:
>> > everything makes sense so far. however when I look at the third.
>> > System.Void TestProject.Whatever`1<TSomething>::Handle(T)
>>
>> There's no Handle method in the type Whatever`1 of your sample. Where
>> is this coming from?
>>
>> > but here T is going to be TSomething. Is there any easy way of figuring
>> out
>> > this? In other words I want to tie together in this case that T is
>> > TSomething does this make sense?
>>
>> Cecil, unlike say, System.Reflection, won't replace the
>> GenericParameters in method signatures by their actual arguments. If
>> you want to do so, you just have to visit the different parameter
>> types or return type of the method, and if it's a GenericParameter,
>> you can try to get its value (the argument) in the generic instance on
>> which the method is declared.
>>
>> For instance, if you have something like:
>>
>> System.Void TestProject.Whatever`1<TSomething>::Handle(T)
>>
>> The declaring type, Whatever`1<TSomething> is a GenericInstanceType,
>> with TSomething as a GenericArguments [0]. The type of the parameter
>> is T, and its position is zero. You can now map T to its argument
>> TSomething.
>>
>> Jb
>>
>> --
>> --
>> mono-cecil
>
>
>
>
> --
> Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer de
> votre attention
>



-- 
Les erreurs de grammaire et de syntaxe ont été incluses pour m'assurer de
votre attention

-- 
--
mono-cecil

Reply via email to