[Mono-dev] RootContext.cs

Marek Safar marek.safar at seznam.cz
Thu Feb 12 10:19:47 EST 2009


Hi,
> I am using the following code to access the variables of class compiled 
> by mcs but I get no output on the console.
>
>   
It depends when you are accessing those fields, but they should be 
available for most of compilation time.

Look how it works in TypeContainer::AddField (FieldBase field)

> ArrayList ad = new ArrayList();
>                
> ad.Add(tc.Fields);
> String[] ia = (String[])ad.ToArray(typeof(String));
> Console.WriteLine(ia[0]);
>             for (int k = 0; k < ia.Length; k++)
>                Console.WriteLine("ia.count"+ia.Length+ia.GetValue(k));
>
> what is the reason for tc.Fields not having any values ? 
>
>   
This code does not make a sense. TypeContainer::Fields returns a 
collection and you are adding this collection into another collection 
and then expecting to get string values, isn't that strange?

Marek

> Marek Safar wrote:
>   
>> Hi,
>>     
>>> I am trying to find out what variables were contained in the c# file 
>>> parsed by mcs. I am looking in RootContext.cs where the whole 
>>> structure is created but I am unable to access the variables of the 
>>> class.
>>> Any help appreciated.
>>>
>>>   
>>>       
>> I don't know what information you need but type fields are stored in 
>> TypeContainer::Fields
>>
>> Marek
>>
>>     
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>   



More information about the Mono-devel-list mailing list