Gururaj’s Rumination

Rumination – The word says it all…

Posts Tagged ‘LinkedIn

Enum.IsDefined and Performance issue

with 2 comments

Till today I’d never used Enum.IsDefined method to verify whether a value is defined in a given Enum. My first encounter with Enum.IsDefined happened a day or two before when I stumbled on this while analyzing existing code for performance loopholes. I found a method which happened to verify whether a value is defined in the given Enum and flag if it’s not. I’d never imagined that Enum.IsDefined can be so expensive that the performance of the component will go down exponentially based on the volume of the data it has to process. To understand better why it’s expensive lets first understand Enum.

Enum is a ValueType and every Enum derives implicitly from System.Enum and this in turn derives from ValueType. To understand in more detail here is the extracted description from the C# Language Specification

11.1.9 Enumeration types

An enumeration type is a distinct type with named constants. Every enumeration type has an underlying type, which shall be byte, sbyte, short, ushort, int, uint, long or ulong. Enumeration types are defined through enumeration declarations (§21.1). The direct base type of every enumeration type is the class System.Enum. The direct base class of System.Enum is System.ValueType.

Given the definition, the below code snippet declares a ‘Status’ enum type. And from definition the underlying type of ‘Status’ type will be Int32. This means that ‘InProgress’ is named a constant for value 0 and ‘Success’ is named constant for value 1 followed by ‘Failed’ as 2. The point to be noted here is that the first named constant always starts with 0 and the subsequent constants have incremental value.

                enum Status
                {
                                InProgress,
                                Success,
                                Failed,
                }

Read the rest of this entry »

Advertisements

Written by Gururaj

December 24, 2008 at 9:57 pm

Posted in Technology

Tagged with , ,

Now on LinkedIn

leave a comment »

I finally created an account on LinkedIn only after seeing a WordPress post/update about WP application support on LinkedIn. This was enough for me to realize how important it is to have a LinkedIn profile. I’d come across LinkedIn in the past too but I ignored it thinking it’s of no use but now I realize it’s more important to have a LinkedIn profile than Orkut profile for any professional contacts.

On one side Orkut is to socialize with people or friends, on the other side LinkedIn is for professional contacts. In just one day I’m able to explore many things and also able to see how helpful it can be in professional growth.

This is going to be the first post which will appear on my LinkedIn profile. This also means that I’ll have to keep writing on topics which can also appear on LinkedIn profile 🙂

See you on LinkedIn then…

Written by Gururaj

October 31, 2008 at 11:03 pm

Answers anywhere everywhere

with one comment

I generally say that I’m the best critic for myself, and this means I always strive to improve myself based on my own personal observation be it How I behave with others, How I dress, How I think differently from others, How I learn the latest technology, How I build my technical skills, or even How I struggle to improve my English and also word power – in simple words it circumvents both my personal and professional life.

I always wished I had a handheld device, like my Cell Phone installed with dictionary application, specifically which has dictionary and that’s also not a Cell Phone to help me quickly do a word look-up while I’m away from reading table like while I’m reading a newspaper, or my favorite novel, or even a technical book on .NET/C#. This even actually made me think many times of designing my own hardware architecture which can support such a need (though I’m not from circuit’s background). If I’d succeeded in such a venture that would have definitely become a hit in the students circle as they too need such a device which will be very handy for them for preparing for GMAT, CAT or for any higher education which requires good vocab. Why I fancy for such device is because I want to learn new words, their synonyms and antonyms.

I once stumbled on this utility, 1-Click Answers, published by Answers.com and I fell in love with this utility instantaneously. Yes! This is one of the kind of utility I was always been looking for which is at least very handy while on Computer.

1-Click Answers doesn’t comes with loads of options or features but whatever it has got is beyond par with any online dictionary versions. Firstly, 1-Click Answers always sits in the Read the rest of this entry »

Written by Gururaj

August 28, 2008 at 12:04 am