Return types in C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Return types in C#

Who know the list of return types uses while declaring method in C#?

11th Jun 2018, 9:48 AM
Fajar Kurniawan
1 Answer
+ 6
- If you're asking for a list of types that can be used for method's return value: Other than the primitive types there's no limit to what a method can return, because anyone can always create their own class for new type definition, and use it as the method's return value type (cmiiw) - If you're asking what is the use (purpose) of return type: It defines what type of information the method will pass back (return) to its caller, it is a part of the method's signature, the method caller needs to know beforehand what type of information the method will return, so the method caller can prepare an appropriate buffer of the said type to hold the information within, for example. Hth, cmiiw
11th Jun 2018, 10:21 AM
Ipang