Background:
I have an open source game library written in C# which is highly tuned for performance, using unsafe code, pointer arithmetic etc. I've recently ported the library to Windows Phone. Unfortunately Windows Phone does not support unsafe code at all, so I have had to litter my source code with preprocessor directives such as this:
#if WINDOWS || XBOX
public unsafe struct Foo
#elif WINDOWS_PHONE
public struct Foo
#endif
Due to the amount of these directives the codebase has become quite unreadable and difficult to maintain, so I've been exploring other options - one of which is text templates using T4.
The Question:
What I need to know before going too far down the T4 route is wether or not it is possible to get compilation symbols from within a text template? I have looked into template parameters but it didn't seem very easy to modify them from the outside world. Ideally what I'd like to see is something a bit like this:
<# if (Host.CompilationSymbols.Contains("WINDOWS_PHONE") { #>
public struct Foo
<# { #>
If anyone could shed some light on wether or not this is possible I'd be grateful!