KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Question 1> Should I check NULL in the following case? public interface INewClass {} public class NewClass : INewClass {} public void FunMeA(INewClass obj) { NewClass n = (NewClass) obj; ... // Should I check (n == null) here? // call methods defined inside INewClass (updated from NewClass to INewClass) ... } A concrete example, public void FunMeB(IAsyncResult itfAR) { AsyncResult ar = (AsyncResult) itfAR; ... // Should I check (ar == null) here? // access ar.AsyncDelegate ... } Question 2> I just start to transfer to C# from C++. When coding in C++, I know when the checking should be done. However, I am totally lost in the C# world. So the question is: is there a general rule that can tell me when I MUST check for NULL? Thank you
Tags (comma-separated)
Save Edits
Cancel