Writing to a MemoryStream (C#) : MemoryStream « File Directory « ASP.NET Tutorial






<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        byte[] data = System.Text.Encoding.ASCII.GetBytes("This is a string");
        MemoryStream ms = new MemoryStream();
        ms.Write(data, 0, data.Length);
        ms.Close();

    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>








10.16.MemoryStream
10.16.1.Writing to a MemoryStream (C#)
10.16.2.Writing to a MemoryStream (VB)