[我的ASP.net学习历程]Reference

类别:Asp 点击:0 评论:0 推荐:

<%@ 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>Chapter 5 - Demonstration of Passing a Parameter by Reference</title>
</head>
<body>
    <asp:Label id="lblMessage" runat="server"></asp:Label>
</body>
</html>

本文地址:http://com.8s8s.com/it/it8566.htm