Tuesday, January 6, 2009

Pre-JITing

How .Net CODE WORKS???

.NET CODE (VB/C#) -> JIT -> MSIL -> JIT -> .net assemblies -> native code /EXECUTABLES

Is there a way I do not want my .NET application code to re-compile on client end each time BY JIT? Is there something like pre-JITing?

Solution...http://msdn.microsoft.com/hi-in/magazine/cc163808(en-us).aspx

Monday, January 5, 2009

Extension methods in .NET 3.5 - An easy alternative to inheritance or wrapper class for adding more functionality to base class...

Check the code attached...

{code}

Imports System.Runtime.CompilerServices
Module Module1
Sub Main()
Dim mystring1 As String = "Hello "
Dim mystring2 As String = "World!!"
Dim finalstring As String = ""
Console.WriteLine(finalstring.AcmeConcateString(mystring1, mystring2))
Console.ReadLine()
End Sub

End Module

Public Module AcmeStringHelpers
<extension()> _
Public Function AcmeConcateString(ByVal GenericParamString As String, ByVal s1 As String, ByVal s2 As String) As String
Return s1 & s2
End Function
End Module


{code}

Easy to understand huh!

Thursday, January 1, 2009

Date comparison in SQL

Date comparison in SQL

I've observed many code where date is compared like below

if  convert(varchar(50), '1/4/2009',101) <= convert(varchar(50), '12/29/2008',101)
begin
print 'true'
end
else
print 'false'

If above is true then what about below code???


if  cast('1/4/2009' as datetime) <= cast('12/29/2008' as datetime)
begin
print 'true'
end
else
print 'false'

When comparing dates in SQL we must cast it to datetime...