打印本文 打印本文 关闭窗口 关闭窗口
[我的ASP.net学习历程]out
作者:武汉SEO闵涛  文章来源:敏韬网  点击数635  更新时间:2009/4/23 10:45:46  文章录入:mintao  责任编辑:mintao

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

    void Page_Load()
    {
        int a = 1;
        int b;
        Increment(a, out b); //out和ref的区别就是out可以不先初始化
        lblMessage.Text = b.ToString();
    }
   
    void Increment(int Number, out int Result)
    {
        Result = Number + 1;
    }

</script>
<html>
<head>
    <title>Chapter 5 - Demonstration of using out Parameters</title>
</head>
<body>
    <asp:Label id="lblMessage" runat="server"></asp:Label>
</body>
</html>

打印本文 打印本文 关闭窗口 关闭窗口