What is the best practice for calling explicit garbage collections?

Monday, December 14, 2009


You should call the finalizer after gc like,

//c#
GC.Collect();
GC.WaitForPendingFinalizers();


www.codecollege.NET

Which one is a best practice to use DirectCast or CType?


DirectCast


www.codecollege.NET

Which is the best practice in applying multiple attributes to a same member?


Instead of applying it as comma seperated, apply individually in separate lines,
//c#
[Conditional("TRACE")]
[DebuggerStepThrough]
void MyMethod()
{
}


www.codecollege.NET

Daily Tips- Tip #41 - How will you mark a method as obsolete?


//c#
[Obsolete("Call NewMethod instead")]
void OldMethod()
{

}


www.codecollege.NET

Daily Tips- Tip #40 - How will you mark a method as Non-CLSCompliant?


//c#
[CLSCompliant(false)]
public void MyMethod(0
{
}


www.codecollege.NET

Daily Tips- Tip #39 - How will you mark an assembly with CLSComplaint?


'VB


//C#
[assembly: CLSCompliant(true)>


www.codecollege.NET

Daily Tips- Tip #38 -What is the short-cut for uncommenting code ?


Ctrl + K, Ctrl + U


www.codecollege.NET

Daily Tips- Tip #37 -What is the Short-cut for commenting out the code?


Ctrl + K, Ctrl + C


www.codecollege.NET

LinkWithin

Blog Widget by LinkWithin

Recommended Books