<html>
<head>
<title>ASCIIEncoding GetBytes Method</title>
<link rel="stylesheet" href="/shared/netdemos.css">
<script language="C#" runat="server">
string html;
byte [ ] alphabetArray;
ASCIIEncoding AE;
void Page_Load ( ) {
string myString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
html += string.Format ( "<p>{0}</p>", myString );
AE = new ASCIIEncoding ( );
alphabetArray = AE.GetBytes ( myString );
html += "<blockquote>";
for ( int x = 0; x <= alphabetArray.Length - 1; x++ ) {
html += string.Format ( "{0}", alphabetArray [ x ] ) + ", ";
}
html = html.Substring ( 0, html.Length -2 ) + "</blockquote>";
myString = myString.ToLower ( );
html += string.Format ( "<p>{0}</p>", myString );
AE = new ASCIIEncoding ( );
alphabetArray = AE.GetBytes ( myString );
html += "<blockquote>";
for ( int x = 0; x <= alphabetArray.Length - 1; x++ ) {
html += string.Format ( "{0}", alphabetArray [ x ] ) + ", ";
}
html = html.Substring ( 0, html.Length -2 ) + "</blockquote>";
}
</script>
</head>
<body>
<!-- #include virtual="~/shared/top.inc" -->
<div class="header"><h3>ASCIIEncoding GetBytes Method</h3></div>
<hr size=1 width=92%>
<div><%= html %></div>
<hr size=1 width=92%>
<!-- #include virtual="~/shared/viewsrc.inc" -->
</body>
</html>