Insert any binary file in C# assembly and extract it at runtime

by rahul 4/3/2010 5:51:40 AM
Problem> There is a binary file (I’ll use an Excel file) that you want to embed in any C# assembly. Later on, at runtime, you want to extract the file from the EXE and continue working on it. In this post, I will share the code and describe how you can do that. You can use the same technique for any other kind of binary file as well. Solution> First up, the reason why you may choose to embed a resource directly into your EXE is to ensure that no one tampers your file on which your code is... [More]


DYK #3 - How can you find out if a method/class/field was annotated with any Attributes without looking at the code?

by rahul 12/12/2008 4:52:00 AM
Well... first of all, open ILDASM and drag/drop your EXE.   The application is called Attributes, and contains an annotated class, some annotated methods and fields. Notice the .custom instance void Attributes.xxxxxxxxx highlighted above. This tells you that the class is annotated. Now, how would you tell if Bar, Foo, and FooBar methods or AttributedVar, NonAttributedVar are annotated or not? (as if the names were not self-explanatory) Double clicking on AnotherAttributedVar and NonAttri... [More]


Play with Colors - Part 2 - Check the font on a specific background using .NET reflection

by Rahul 6/13/2008 2:30:25 AM
I have already shown how to use .NET reflection to get the information about all the colors in .NET. Let's say you want to check out how a specific colored font would appear on any background, you may like to check this sample. Use the code which follows to get an output like the one below. There are various ways to get this output, but I guess this code is pretty small and will show you some of the things that you could do with System.Reflection in .NET. Here is the code... <%@ ... [More]


Play with Colors - Part 1 - See all the colors using .NET reflection

by Rahul 6/10/2008 11:58:00 AM
When you work on designing a website, you may find it difficult to remember all the color names and visualize them. At least, I am personally not very good with color selection and find it really hard to recall the color names. So, in this scrap we will check out how to use .NET reflection to print out all the color names along with the colors... There is a very small piece of C# code which I have used here to create a 2 column color table. Check the sample And here is the code that would ... [More]


Search


Tags



Categories

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0