Thursday, December 1, 2022

Out Parameter in ASP.NET C#

we donot have to give it's value(intialize it's value)


 DateTime LastDate;


            string TransferCycleCategory = CheckTransferCycleCategory(FMSID, out LastDate);



 public string CheckTransferCycleCategory(Int64 FMSID, out DateTime LastDate)

    {

        DataTable dt = Repository.GetCurrentTransferCycle();

        DateTime StartDate = Convert.ToDateTime(dt.Rows[0]["StartDate"]);

        DateTime EndDate = Convert.ToDateTime(dt.Rows[0]["EndDate"]);

        string TransferCycleType = dt.Rows[0]["TransferCycleType"].ToString();

        LastDate = StartDate;

        return TransferCycleType;

    }


reference:- https://www.tutorialspoint.com/difference-between-out-and-ref-keyword-in-chash

No comments:

Post a Comment