Why am I getting these out parameter errors in C#?

前端 未结 5 1470
孤独总比滥情好
孤独总比滥情好 2020-12-19 02:04

I am new to C#. I\'ve tried this with out parameter in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Firs         


        
5条回答
  •  清歌不尽
    2020-12-19 02:28

    ref means that you are passing a reference to the variable that has been declared and initialized, before calling the method, and that the method can modify the value of that variable.

    out means you are passing a reference to the variable that has been declared but not yet initialized, before calling the method, and that the method must initialize or set it's value before returning.

提交回复
热议问题