How To Use Out Parameter

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

    void Page_Load()
    {
        int a = 1;
        int b;
        Increment(a, out b);
        lblMessage.Text = b.ToString();
    }
   
    void Increment(int Number, out int Result)
    {
        Result = Number + 1;
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Demonstration of using out Parameters</title>
</head>
<body>
    <form id="form1" runat="server">

    <asp:Label id="lblMessage" runat="server"></asp:Label>


</form>
</body>
</html>

No comments:

Post a Comment