What is returning "nothing" from Excel.Range.find in c# -


what nothing mean me, when api tells me function returns nothing? need use try-catch block call function? give me issue if try set equal nothing? basically...what proper way of handling "nothing"?

excel.range headers = exsheet.range[exsheet.cells[1], exsheet.cells[numcols]]; excel.range columnheader;  //some code...  columnheader = headers.find(columnlist[i]); 

documentation-

this method returns nothing if no match found.

excel.range.find

upon reading documentation see method returns microsoft.office.interop.excel.range fine, know ran problems earlier function returned range (range.specialcells) had use try-catch block in order ensure wouldn't crash program if no special cells found.

see what's equivalent of nothing?:

for reference types, equivalent of vb's nothing c#'s null. value types, it's default value - 0, false, etc.

so according documentation, should fine when check null.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -