Just for my clarification :
Can i throw both CLS-Complaint and non-CLS complaint exceptions in .NET Framework ?.I am using C# 3.0.
When i catch exception
Although the C# compiler allows developers to throw Exception-derived objects only, prior to C# version 2.0, the C# compiler did allow developers to catch non-CLS-compliant exceptions by using code like this:
private void SomeMethod() {
try {
// Inside the try block is where you put code requiring
// graceful recovery or common cleanup operations.
}
catch (Exception e) {
// Before C# 2.0, this block catches CLS-compliant exceptions only
// In C# 2.0, this block catches CLS- & non-CLS- compliant exceptions
throw; // Re-throws whatever got caught
}
catch {
// In all versions of C#, this block catches
// CLS- & non-CLS- compliant exceptions
throw; // Re-throws whatever got caught
}
}