Feb 28, 2009

Global Variable in C# | Application Cache Vs Static Variable

Some times we need to use some variable globaly so that it may be available to application wide. For having a global variable we can use static variables as well application cache.

Example :

Application["gVar1"]="Global variable One stored here";
and this can be get anywhere in application by using string var1 = (string)Application["Var1"];

The same thing can be by using static variable also.

public static string GVar1;

These variables need to be initialized first time into Global.asax.cs application_start() method and keep alive until a IIS reset or worker process recycle not occurs.

Application_Start()
{
Application["gVar1"]="Global variable One stored here";
Gvar2= "Global Variable Two is here";
}
For using the Gvar2 we need to simply write the className.Gvar2 // Here Global.Gvar2 will do the work for us.


So the question arise as both are doing the same work which we prefer to use.
I must say It depends!!

Why I said so? Because there are reasons behind this.
In the above scenario I must say I MUST use static variable. (Please make static property rather than directly using static variable)
So what factors you must count for choosing static -
1. Application holds variable as Object.
2. While getting the value we need to caste into the objects which it stores. Of course casting need some value.

So when we need to use some primitive variables and they are not going to changes very frequent (locking issue in case of frequent changes) we should use static variable.
Application need to be used when we need to Hold some objects application wide.
(Note Its my own experience please do not take it as hard and fast rule).

Thanks

Feb 22, 2009

UP CPMT2009

Uttar Pradesh Combined Pre Medical Test is an examination conducted by University of Lucknow on behalf of the Government of Uttar Pradesh. The examination is conducted for admission to various medical courses in Government and recognized, approved Medical, Dental, Homeopathic, Ayurvedic and Unani Colleges of Uttar Pradesh.

Important dates of UPCPMT

1. Feb to first week of March 2009 – availability of application forms.
2. 2nd week of March 2009 – deadline for submission of completed application forms.
3. Mid of May 2009 – date of examination.

Eligibility criteria for UPCPMT

  • The candidate must be a citizen of India and must have domicile of Uttar Pradesh.
  • The candidate must have cleared class 12th examination with PCB and English as one of the main subjects.

Courses offered for UPCPMT

1. MBBS
2. BDS
3. BHMS
4. BAMS
5. BUMS

Examination pattern and syllabus:

1. The examination will be conducted in two parts.
2. The first paper will contain questions from Zoology and Botany and the timings will be from 10:00 AM-12:00 Noon
3. The second paper will have questions from Chemistry and Physics and the timings will be from 2:0O PM-4:00 PM.


For more information keep watching this page....


Feb 8, 2009

AMU Admission Notice 2009 - 2010

Aligarh Muslim University (AMU) announces the admissions Notice for Academic session 2009-2010. First time AMU Entrance Test will be held on five centres across India (Only for BTech and MBBS/BDS), Rest of the Test courses will be held on Aligarh except Class XI/Diploma Engineering which will be held in Lucknow also along with Aligarh. For more information visit :http//amu.ac.in

Admissions related more information/Application Form can be downloaded at http://amucontrollerexams.com

Examination Notice:

SQL - Difference between CAST,CONVERT and PARSE

TODO---