Hi

Maybe this could give you some ideas: (T4 Templates)


<#@ template debug="false" hostspecific="false" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Reflection" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ output extension=".cs" #>
using System.Reflection;
public class KeepStuff
{
    public void KeepStuffAgain()
    {
        PropertyInfo list = null;
<#
    foreach (PropertyInfo info in typeof(PropertyInfo).GetProperties())
    {
#>
        var value<#= info.Name #> = list.<#= info.Name #>;
<#
    }
#>
    }
}

This generates the code:


using System.Reflection;

public class KeepStuff

{

public void KeepStuffAgain()

{

PropertyInfo list = null;

var valueMemberType = list.MemberType;

var valuePropertyType = list.PropertyType;

var valueAttributes = list.Attributes;

var valueCanRead = list.CanRead;

var valueCanWrite = list.CanWrite;

var valueGetMethod = list.GetMethod;

var valueSetMethod = list.SetMethod;

var valueIsSpecialName = list.IsSpecialName;

var valueName = list.Name;

var valueDeclaringType = list.DeclaringType;

var valueReflectedType = list.ReflectedType;

var valueCustomAttributes = list.CustomAttributes;

var valueMetadataToken = list.MetadataToken;

var valueModule = list.Module;

     }

}




Sorry about the weird formatting, IE and GMail seems to be bust. Aaaargh! I
can't press the delete key. :(


hope it can give come ideas on generating the members.

Matthew


On Mon, Jul 23, 2012 at 6:46 PM, Goncalo Oliveira <gonc...@minkan.net>wrote:

> Hi,
>
> I'm getting a lot of exceptions with the release version that I didn't
> have with the debug one.
> It's getting hard to trace them all, because even though I can get the
> stacktraces from ddms, I can't replicate them in the debug version, so it's
> kind of difficult to know what's wrong!
>
> So... maybe there's a guide somewhere on this? Common errors, things to
> avoid, anything?...
>
> Cheers,
>
> --
> Gonçalo Oliveira
>
> _______________________________________________
> Monodroid mailing list
> Monodroid@lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to