Archive for the ‘c#’ Category

Working with jQuery

I have now been working with jQuery for a while and found very good usage in using there specific features:
Together with MS Ajax:
Using jQuery together with MS ajax results in some $ naming conflicts, since both MS Ajax and jQuery used the $ use their default namaspace.
It can be resolved by either rename the jQuery [...]

Leave a Comment

Compile and run userdefined c# code from within your app

Sometimes customers requires the ability to write small pieces of custom code that should be run from within your application. And not only that, you want to be able to get resulting variables from that user code, inside your application.
An example could be an advanced calculator, where some of the algorithms are defined by the [...]

Leave a Comment

Updating an element on a form from a different thread

Sometimes its a good idea to spawn a new thread from the GUI, to do some heavy calculation or
other time consuming task, to avoid the GUI to freeze as the task is running.
When a thread has been spawned, it would often also be nice to recieve som kind of
feedback from the calculation, of progress and [...]

Leave a Comment

How to determine if a type is a Nullable

Yesterday I had a problem determining whether a supplied type was of the type Nullable. Here is the solution:

Type mt = suppliedVar.GetType();

if(mt.IsGenericType && mt.GetGenericTypeDefinition() ==
typeof(Nullable)) && mt.GetGenericArguments().Length>0)
{
if(mt.GetGenericArguments()[0].IsEnum) {
// Type is a Nullable
}
}

Leave a Comment

Crypting and decrypting sections in web.config

Sometimes you need to have sensitive information in your config files, information that you would like to hide from other people with access to the sourcefiles. That could be database credentials placed in the section, as in this example:

To [...]

Leave a Comment

Get Adobe Flash playerPlugin by wpburn.com wordpress themes