Like other classes and interfaces are shared/reused among the namespace, here description of  "Equals" method (don't mix up with equal operators in standard queries doc_mm.LINQIntro3 ) System.Linq.Expression.Namespace is given in Object class (owner?). For more details visit this site

http://msdn.microsoft.com/en-us/library/bsc2ak47.aspx

Step :1 Create new website and add the items shown in this illustration.

Step 2: add the codes given below

main.css

body
{
background-color:Gray;
}
#div1
{
background-color: #FFFFCC; color: #000080; position: absolute; width: 550px; height: 300px;
padding-left: 20px; background-position:center;
}
table
{
width:500px; height: 300px;
}
td
{
vertical-align:top;
}

Code: Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

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

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>mm.LINQExpression1</title>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="div1">
<table >
<tr><td colspan="2">&nbsp;&nbsp;LINQ Extension Method Equals</td>
</tr>
<tr>
<td><asp:Label ID="L1" runat="server" Text="<br/>"></asp:Label></td>
<td><asp:Label ID="L2" runat="server" Text="<br/>"></asp:Label></td>
</tr>
</table>
</div>
</form>
</body>
</html>
 

Code. Default.aspx.cs

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Student _students = new Student();
Student students = new Student();
Student[] std1 = _students.GetStudent();
Student[] std2 = _students.GetStudent();
Student[] std3 = std1;
Object obj1 = new Student();
Object obj2 = new Student();
Object obj3 = new Object();
Object obj4 = new Object();
String str1 ="Hellow World";
string str2 ="Hellow World";
string str3 = str1;
L1.Text +="<u>(str1.Equals(str2)).ToString() </u>>"+ (str1.Equals(str2)).ToString(); L1.Text += "<br/>";
L1.Text += "<u>(str2.Equals(str2)).ToString() </u>>" + (str2.Equals(str2)).ToString(); L1.Text += "<br/>";
L1.Text += "<u>(str1.Equals(str3)).ToString() </u>>" + (str1.Equals(str3)).ToString(); L1.Text += "<br/>";
L1.Text += "<u>(std1.Equals(std2)).ToString() </u>>" + (std1.Equals(std2)).ToString(); L1.Text += "<br/>";
L1.Text += "<u>(std3.Equals(std1)).ToString() </u>>" + (std3.Equals(std1)).ToString(); L1.Text += "<br/>";
L1.Text += "<u>(obj1.Equals(obj2)).ToString() </u>>" + (obj1.Equals(obj2)).ToString(); L1.Text += "<br/>";
L2.Text += "<font color='red'> Before obj3 = obj4; </font> ";
L2.Text += (obj3.Equals(obj4)).ToString(); L2.Text += "<br/>";
obj3 = obj4;
L2.Text += "<font color='red'> after obj3 = obj4;</font> ";
L2.Text += (obj3.Equals(obj4)).ToString(); L2.Text += "<br/>";

L2.Text += "Results from Student[] std3 = std1; <br/>";
foreach (var item in std3)
{
L2.Text += item.Name + " : " + item.Subject;
L2.Text += "<br/>";
}
}
}
 

Code Student.cs

using System;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Collections.Generic;
using System.Collections;
/// <summary>
/// Summary description for Player
/// </summary>
public class Student
{
public string Name { get; set; }
public string Subject { get; set; }
public int ID { get; set; }
public List<int> Scores { get; set; }

public Student()
{
//
// TODO: Add constructor logic here
//
}
public Student[] GetStudent()
{
Student[] student =
{ new Student { Name="Daniel",Subject="Chemistry",ID=8 },
new Student { Name="David",Subject="Chemistry",ID=8 },
new Student { Name="Brandon",Subject="Chemistry",ID=8 },
new Student { Name="Zared",Subject="English",ID=4 },
new Student { Name="Vishal",Subject="History",ID=1 } };
return student;
}
}
 

Step: 3 run time analysis