I see some code will return the default value, so I am wondering for a user defined class, how will the compiler define its default value?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To chime in with the rest, it will be
null, but I should also add that you can get the default value of any type, usingdefaultIt can be especially useful when working with generics; you might want to return
default(T), if your return type isTand you don’t want to assume that it’s nullable.