Professional Documents
Culture Documents
Amazedsaint's Tech Journal: 3 Gems in Mono for .NET Programmers The hidden potential of Mono.CSharp, Mono.Cecil And Mono.TextTemplating
search
Anoop's observations on tech, web, design & architecture, .net and more..
Home
C#
.NET
Web
Javascript
Bigdata
Architecture
Archive
Subscribe
ANOOP MADHUSUDANAN
Follow @am azedsaint
submit
Tw eet
Subscribe
Mono is getting more mature. I should say, Mono guys are even
Feeds
Like In Facebook
scripting language
Anders in his C# Futures Talk mentioned about C# Compiler as a
Amazedsaint's
.NET Journal
Like 471
implementation. And few months back, I got pretty surprised when I found that Mono announced Compiler
as a Service support. This will enable you to evaluate C# code on the fly, and more importantly, to use C#
as a scripting language in your applications. Here is a step by step guide to this feature.
Hosting Monos C# Compiler As a Service in .NET Apps
Dynamic Filtering and Querying in .NET Applications
Using C# as a scripting language
2 - Mono.TextTemplating For T4 (Text Templating) Functionality in your .NET applications
In a lot of scenarios, a custom text template processor comes in handy. I remember putting together a
simple, custom Text template processor some time back for generating Emails. With in Visual Studio, there
is a Text Templating transformation engine built in, better known T4. It is used for a lot of scenarios, mainly
for generating code from Models, and is used in various VS Packages for code generation purposes. You
can also write your own Template files (*.tt) with in Visual Studio, and Clarius has a cool T4 Editor available
About Anoop
http://www.amazedsaint.com/2010/10/monocsharp-monocecil-and.html
1/5
4/4/2015
Amazedsaint's Tech Journal: 3 Gems in Mono for .NET Programmers The hidden potential of Mono.CSharp, Mono.Cecil And Mono.TextTemplating
MVC using Mono.TextTemplating and the related example code. More than an ASP.NET MVC View Engine
example, it is also an example of how to host the T4 Engine in your own applications.
3 - Mono.Cecil For Modifying .NET Assemblies, And a better alternative to .NET Reflection
If you use .NET Reflection heavily, you should have a look at Mono.Cecil. You can also use Mono.Cecil to
modify a compiled assembly, or to weave some code in to your assemblies (AOP) directly. To try out Cecil,
get the latest version 0.9 from Github and compile Mono.Cecil library in VS2010.
Now, create a console application in Visual Studio, and try this example after adding a reference to
Mono.Cecil.dll.
using System;
using System.Collections.Generic;
using System.Linq;
Seeker.
using System.Text;
using Mono.Cecil;
FOLLOW =>
namespace CecilAppTest
{
class Program
{
static void Main(string[] args)
Featured
{
//Open a given assembly. Let us assume the
//first command line param is the path to the assembly to load and inspect
AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(args[0]);
.NET Programmers
Recently Popular
}
//All properties in this type
foreach (var propDef in typeDef.Properties)
{
Console.WriteLine("
}
}
}
}
Top 7 Coding
Standards &
Guideline
Documents For
C#/.NET Developers
Some time back, I collated a list
of 7 Must Read, Free EBooks for
.NET Developers , and a lot of
people found it useful. So, I
thought about...
}
}
Hack
Raspberry Pi
Compile the above example, and try it against a .NET dll to see the output, by providing the target
assemblys path
Share
The above example shows how to iterate through all modules, types, methods and properties in an
assembly using Mono.Cecil. What is more interesting is, you can even modify the information and even
save it back. Paul has a good post on using Cecil to obfuscate your .NET assemblies. Also, have a look at
his NCloak obfusctor, it is open source, that is built leveraging Cecils power.
How To Build
Apps In C#,
WinForms and ASP.NET
Using Mono In Pi
Recently I was doing a bit of R&D
related to finding a viable, low
cost platform for client nodes.
Also, check out my C# AccessPrivateWrapper where I explore how to use reflection to access private
http://www.amazedsaint.com/2010/10/monocsharp-monocecil-and.html
2/5
4/4/2015
Amazedsaint's Tech Journal: 3 Gems in Mono for .NET Programmers The hidden potential of Mono.CSharp, Mono.Cecil And Mono.TextTemplating
Raspberry Pi...
Like
Analyzing some
Big Data Using
C#, Azure And
Apache
Hadoop A Stack Overflow
.NET Namespace Popularity
Finder
0 Comments
Recommend
Share
Login
Sort by Oldest
Time to do something
meaningful with C#, Azure and
Apache Hadoop. In this post,
well explore how to create a
Subscribe
Changing
Times For Web
Newer Post
Older Post
Developers 6
Tips You
Should Read To Survive
The context of this post is about
the changing times for a web
developer, and I see a lot of web
developers still lagging behind
especiall...
An
Asynchronous
Delegate
Command for
your WPF MVVM Apps AsyncDelegateCommand
This post assumes you are
familiar with basic MVVM
concepts and
RelayCommand/DelegateCommand
In a lot of scenarios, you need to
perform o...
Type Script
Language
Features
Classes,
Inheritance & Overriding
Type Script brings a lot more
structure and object oriented
goodness to JavaScript, thought
under the hood it is just a Syntax
sugar for Jav...
http://www.amazedsaint.com/2010/10/monocsharp-monocecil-and.html
3/5
4/4/2015
Amazedsaint's Tech Journal: 3 Gems in Mono for .NET Programmers The hidden potential of Mono.CSharp, Mono.Cecil And Mono.TextTemplating
5 Awesome
Learning
Resources For
Programmers
(To help you and your kids
to grow the geek neurons)
Happy New Year, this is my first
post in 2012. Ill be sharing few
awesome learning resources Ive
bookmarked, and will be pointing
out some...
7 Freely
available EBooks/Guides I
found essential
for .NET Programmers and
Architects
A lot of people ask me for good
book recommendations. Hence,
for some time, I was thinking
about compiling a quick list of
useful free E-Boo...
CakeRobot - A
Gesture Driven
Robot That
Follows Your
Hand Movements Using
Arduino, C# and Kinect
Over the last few weekends Ive
spend some time building a
simple robot that can be
controlled using Kinect. You can
see it in action below....
12
Share
ElasticObject
SignalWire
Kibloc/Kinect
Ksigdo
Vingy
http://www.amazedsaint.com/2010/10/monocsharp-monocecil-and.html
Must Read
7 Freely Available Ebooks For .NET
developers
Total Pageviews
3,097,981
4/5
4/4/2015
Amazedsaint's Tech Journal: 3 Gems in Mono for .NET Programmers The hidden potential of Mono.CSharp, Mono.Cecil And Mono.TextTemplating
Top 5 Common Mistakes .NET
Developers Must Avoid
6 Cool VS2010 Tips you may find
interesting
4 .NET 4.0 Libraries you *should*
know about
Translate
Select Language
http://www.amazedsaint.com/2010/10/monocsharp-monocecil-and.html
Powered by Blogger.
5/5