c# example - int array contains
int-array-contains.aspx
<%@ Page Language="C#" AutoEventWireup="true"%>
<!DOCTYPE html>
<script runat="server">
protected void Button1_Click(object sender, System.EventArgs e)
{
int[] marks = new int[]
{
82,
75,
58,
42,
65
};
Label1.Text = "marks array.........<br />";
foreach (int i in marks)
{
Label1.Text += i.ToString() + "<br />";
}
Boolean result = marks.Contains(2);
Label1.Text += "<br />'2' mark contains in marks array? " + result;
Boolean result2 = marks.Contains(82);
Label1.Text += "<br />'82' mark contains in marks array? " + result2;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>c# example - int array contains</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">
c# example - int array contains
</h2>
<hr width="550" align="left" color="LightBlue" />
<asp:Label
ID="Label1"
runat="server"
Font-Size="X-Large"
>
</asp:Label>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
Text="check int array contains a value"
OnClick="Button1_Click"
Height="40"
Font-Bold="true"
/>
</div>
</form>
</body>
</html>
