Following my Example code for describe the issue,
following i have written the generic method to Search thru the list by using given search value
if value in list return the list and otherwise return NULL Value.
According to the code it seems ok.but it get following error
Cannot convert null to type parameter 'T' because it could be a value type
For avoid that issue following option
1- Method
Return default(T) which means you'll return null if T is a reference type (or a nullable value type), 0 for int, '\0' for char etc
2- Method
Restrict T to be a reference type with the where T : class constraint and then return null as normal
Subscribe to:
Post Comments (Atom)
-
The string pool is a table that contains a single reference to each unique literal string declared in your application which use by the Com...
-
Following my Example code for describe the issue, following i have written the generic method to Search thru the list by using given sear...
-
When we use Collection in our code , sometime we need to modify (delete) collection during the Iteration. but we can't remove element d...
Free Spins for Three People in one CasinoSites
ReplyDeleteThe top three gambling casinos, 공주 출장마사지 listed 속초 출장안마 in the United States, are Casino Palace and Casino 논산 출장샵 Palace. 경산 출장샵 Casino Palace has the largest 1xbet number of slots and