ali raza

C#, .Net , and my thoughts

Monthly Archives: May 2006

hello every body

sorry this another day when i have nothing to post

c# and vb classes can be used in same 2 application

It is possible in 2 that c# an classes can be used in same project

All class files are contained in \app_Code folder which is compiled into single assembly.

It is possible that classes placed in same folder causes error. So make different folders in \app_data such as “vbclasses” and “c#classes”


\ App_Code              

                         \ vbclasses

                          \ c#classes



 now places  vb and c# classes in their respective folders as

\ App_Code              

                         \ vbclasses


                          \ c#classes



now we have to add some lines in web.config under the compilation key



      <add directoryName=”vbclasses”></add>

      <add directoryName=”c#classes”></add>



now compile the code in single assembly and we can use the implementation of code placed in vb or c# class in our application without specifying their extensions


nullable types in .net framework 2

Value types in dot net framework 2 have some extension that either it take value or not. This extension is called nullable types. For example if  we need int32.  we declare it as

        Dim myint as nullable(of int32)

Now myint can hold value of type int32 if we assign it other wise it contain null value   

If we assign myint to  23 it holds integer value

Other wise  it contain null value.

This nullable extension in only available to value data type in .net framework 2

The two most important properties of nullable value types are

  1. hasvalue (default value is false)
  2. value 

both these types are read only.

Before using the variable check its hasvalue property . If it return true it means variable holds some value. Other wise it returns false.


Dim myint As Nullable(Of Int32)        myint = 32   

     If myint.HasValue Then 

           MsgBox(myint.Value & "has value  ")      


       MsgBox("no value")

        End If


Code Monkey Like Fritos

This has got to be one of the funniest songs I’ve heard of in awhile. The odd thing is that it speaks to me as well, has a catchy tune, and only costs $1 to buy it from the guy! Without further ado…"Code Monkey" by Jonathan Coulton.
“Code Monkey like Fritos
Code Monkey like Tab and Mountain Dew
Code Monkey very simple man
With big warm fuzzy secret heart:
Code Monkey like you”

some thing about value and reference type

  • In value type based variables holds memory on stack and hold fixed space for example integer in dot net hold 4 bytes.
  • In reference type based variables holds memory at managed heap. Reference type variables hold dynamic space. The space hold by reference type can be vary.

When reference is to assign to variable. Only reference is stored in variable. Where this reference is refer actual memory is stored in heap where actual value or data is placed.

Stack is small area of memory where fixed no of space is reserved . for example integer , double  always contain same area of memory. So they placed in stack.

While heap is dynamic memory where variable for example string can hold 2 bytes or it contain all available of physical memory .