Posts

The Surprising Finalize Call

Guess the output of the following program:-

class SomeClass : IDisposable
{
  public SomeClass()
  {
		Trace.WriteLine("SomeClass - Attempting instance creation");
		throw new Exception("Ohh !!! Not Now");
	}

	public void Dispose()
	{
		Trace.WriteLine("SomeClass::Dispose");
	}

	~SomeClass()
	{
		Trace.WriteLine("SomeClass::Finalizer");
	}
}

int Main(string args[]){
	try{
		SomeClass sc = new SomeClass();
  }
	catch(Exception ex){
		Trace.WriteLine("Main - {0}", ex.Message);
  }
}

This will be the output of the program:-

More ...

Learning Type Access Modifiers Basics

When I started developing my module, I had an interface IParamCountBasedAlgo declared as a nested type in a class AlgorithmOneExecutor, declared as follows:-

namespace DataStructuresAndAlgo
{
   partial class AlgorithmOneExecutor
   {
      private interface IParamCountBasedAlgo
      {
         void Validate();
         void Execute();
      }
   }
}
More ...

First Google Gadget(s)

I did some cool stuff here with google. I wrote my first β€œHello World” sort of google gadget. It claims no rewards but just was fun. Since I am a novice in html and javascript sort of things, this gadget is pretty simple.

Use the following URL to enjoy the gadgets.:

Follow the trail…….Join the Concurrency Revolution !!!

I could not stop writing this post after I read this article by Herb Sutter. The article is just a casual technical discussion but very encouraging that a person requires at the right time – the time when he is a student. Even after several years after my college, I have been trying to keep myself a student and I got a right encouragement to join the Concurrency revolution. Thanks to Herb Sutter. More ...

The New Looking Post

I am very much fond of tools, updates and stuff. So I keep updating my softwares and hear/learn about new tools etc. I am excited about the new spaces - Live Spaces. Looks much better than before. I thought I would write something about the new spaces. Please spaces guys, make the arranging the boxes on the home page a bit easier and intelligent. That is a feature request. Otherwise the default skin/theme is cool and professional. Old themes are still old and not much appealing. Anyway, i write the post just to say i love it. More ...

where enum does not work

I was writing a generic method with enum as the Constraint, and the compiler spat a few errors that did not directly convey me that enums cannot used as generic constraints. I learnt the following from my investigation:

Following is an excerpt from the C# language specification for generic constraints


A class-type constraint must satisfy the following rules:

Overloading - A Matter Of Taste

This was a pretty interesting discussion about method overloading in the managed world. As the discussion says that the overloading is a matter of taste. It seems that the method overloading in the managed world, indeed, is a matter of taste. Sad BUT True !!! But on the contrary, it must have been a [strict] rule. Overloading might be exhibited differently by each language in the unmanaged world. But as far as .NET goes, it must have been made a standard specification. Pardon me, if there is one. More ...

Fooled by the Activator !!!

It was interesting to know that a custom exception, say an exception class derived from System.ApplicationException, thrown while creating an instance of a type using Activator.CreateInstance does not get caught in its appropriate exception handler, instead gets caught in the global exception handler catch(Exception ex), if provided. Any exception raised while creating an instance of the loaded type is wrapped inside a new exception object as InnerException by Activator.CreateInstance.

I was fooled that there was some problem with the image generation for quite some time, and then very lately inspected the members of the exception caught and found my exception object wrapped as InnerException.

More ...

Properties C# 2.0 – Not Elegant Enough

Prior to .NET 2.0, there wasn’t the facility in C# to opt the visibility level for the get and set property or indexers. And i take my comment in my previous post that C# does not provide the facility of having different visibility levels for the get and set accessors. While that is partly correct, it is no more in C# 2.0.

And obviously it isn’t in the easy and elegant way. Take a look at this code snippet:-

More ...

Singularity – Safety & Speed !!!

I read about this interesting thing somewhere in MSDN.

There are two types of programming or programming languages. The good old C/C++ kind called the unsafe programming languages, and the other is the safe programming type which we realised very much after advent of Java/C#. And there has always been debate about safety and speed. And neither of the two has won.

So Microsoft is doing a research on a new operating system called Singularity which is written in a safe programming language [C#]. Although there are parts in the OS, especially the kernel, that uses unsafe code, it stills uses the safe C#. So in the Singularity environment, every program that runs is safe. And the environment as such is reinventing from the hardware layers up and above.

More ...