官术网_书友最值得收藏!

Reference returns

Reference returns allows a method to return an object as a reference instead of its value. We can define the reference return value by adding a ref keyword before the type in the method signature and when returning the object from the method itself.

Here is the signature of the method that allows reference returns:

public ref Person GetPersonInformation(int ID); 
 
Following is the implementation of the GetPersonInformation method that uses the ref keyword while returning the person's object.  
 
Person _person; 
public ref Person GetPersonInformation(int ID) 
{ 
  _person = CallPersonHttpService(); 
  return ref _person; 
} 
主站蜘蛛池模板: 历史| 黄石市| 六安市| 吉首市| 扬中市| 曲沃县| 绥江县| 宣武区| 巴塘县| 通辽市| 留坝县| 东阿县| 普格县| 鲜城| 霍邱县| 滨海县| 万源市| 五家渠市| 石首市| 娄底市| 原阳县| 宁河县| 许昌市| 屯门区| 密云县| 甘孜县| 万源市| 涟水县| 睢宁县| 任丘市| 鄂托克前旗| 若尔盖县| 衡阳市| 瑞昌市| 三门县| 信丰县| 泌阳县| 桐乡市| 曲阜市| 赤壁市| 抚顺市|