C# Exception Equals(Object)

In this chapter you will learn:

  1. Get to know Exception.Equals(Object)
  2. Syntax for Exception.Equals(Object)
  3. Parameter for Exception.Equals(Object)
  4. Returns for Exception.Equals(Object)
  5. Example - Exception.Equals(Object)

Description

Exception Equals(Object) determines whether the specified object is equal to the current object.

Syntax

Exception.Equals(Object) has the following syntax.


public virtual bool Equals(
  Object obj
)

Parameters

Exception.Equals(Object) has the following parameters.

  • obj - The object to compare with the current object.

Returns

Exception.Equals(Object) method returns true if the specified object is equal to the current object; otherwise, false.

Example


using System;/*ww  w.  java2  s. c om*/
public class MainClass{
  public static void Main(String[] argv){  
    Exception e = new Exception("asdf")
    Exception e1 = new Exception("asdf")
    
    System.Console.WriteLine(e.Equals(e1));
  }
}

Next chapter...

What you will learn in the next chapter:

  1. Get to know Exception.Finalize
  2. Syntax for Exception.Finalize
  3. Returns for Exception.Finalize
  4. Example - Exception.Finalize
Home »
  C# Tutorial »
    System »
      Exception
C# Exception Data
C# Exception HelpLink
C# Exception InnerException
C# Exception Message
C# Exception Source
C# Exception StackTrace
C# Exception TargetSite
C# Exception Exception()
C# Exception Exception(String)
C# Exception Exception(String, Exception)
C# Exception Equals(Object)
C# Exception Finalize
C# Exception GetBaseException
C# Exception GetHashCode
C# Exception GetType
C# Exception MemberwiseClone
C# Exception ToString