Function Parameter passed by Reference (C#) : Function « Language Basics « ASP.Net






Function Parameter passed by Reference (C#)

<%@ Page Language="C#" %>
<script runat="server">

    void Page_Load()
    {
        int a = 1;
        Increment(ref a);
        lblMessage.Text = a.ToString();
    }
    
    void Increment(ref int Number)
    {
        Number += 1;
    }

</script>
<html>
<head>
    <title>Demonstration of Passing a Parameter by Reference</title>
</head>
<body>
    <asp:Label id="lblMessage" runat="server"></asp:Label>
</body>
</html>

           
       








Related examples in the same category

1.Define and call function in a page (VB.net)
2.Page level procedure (VB.net)
3.Define function to change 'HR' length (C#)
4.Function Parameter passed by Value (C#)
5.Using out Parameters (C#)
6.Simple function without parameters (C#)
7.Define and call function (C#)
8.Call function (C#)
9.Function local variable (C#)