How to use "void" is C Sharp?

2007-10-22 6:49 am
How to use "void" is C Sharp?

回答 (1)

2007-10-22 3:24 pm
✔ 最佳答案
void used in a method to indicate that the method is not returning any value.

Example
' a method that return values
int Bigger(int x, int y)
{
if (x > y)
return x;
else
return y;
}

' a method that does not return values
void myMethod(int x, int y)
{
if (x > y)
return; // execution of this mehtod ends here
else
' your code here
}


收錄日期: 2021-04-25 20:33:25
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20071021000051KK05808

檢視 Wayback Machine 備份