G # is a new language based on the .NET platform, which can inject new code in the compile period and the original code. And the new code can also ensure type security under the .NET platform.
Unlike CODesmith is its code generation technology to add new features to existing code, which is the goal to be implemented by the current AOP technology.
If you use Aspectj, you will find the ugliness of its grammar, while the grammar of the G # 2.0 is a subset of C # 2.0. It looks very easy to understand. And G # is based on .NET's IL language, so whether it is C # or VB .NET can play its power.
Look at a small example, you will find the geometical thing of G #.
Public class client () {Messenger ("Hello World"); "String Message) {Console.writeline (Message);}}
Public generator rename {static generation changeit: target client.Messenger (string message) {pre {string oldMessage = message;
Message = "Hello G #";} post {message = OldMessage;}}}
Take a look at the new code after using G # injected:
Private Void Messenger (String Message) {// from changet preload. String OldMessage = Message;
// from changeit preload. Message = "Hello G #";
// from the Messenger method body. Console.writeline (Message);
// from changit post block. Message = OldMESSAGE;
For specific information about G #, please visit here.