Best practice: ref parameter or return value?

后端 未结 4 1211
悲哀的现实
悲哀的现实 2020-12-13 11:00

Actually I am doing a list as a reference parameter as follows:

public static List ListMethod(List result)

I saw some people doing in this

4条回答
  •  渐次进展
    2020-12-13 11:45

    One thing special about ref Parameter here is that - "A variable passed with ref must be assigned value first.". So if you want to make it strict for the calling method to assign value before the call you can probably use ref Parameters.

提交回复
热议问题