why listbox1.Items.Add use Equals Method of my Object ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mahdi Zareie
    New Member
    • Jan 2012
    • 2

    #1

    why listbox1.Items.Add use Equals Method of my Object ?

    Hi all
    i'm scrutinizing Windows Forms ListBoxCollecti on Add Method,
    during the analyzing i found that the method "add" calls Equals method in base Object
    why this method do this action ?
  • Mahdi Zareie
    New Member
    • Jan 2012
    • 2

    #2
    I Have used "Call Stack" and I have Find This Answer :

    We Call :System.Windows .Forms.ListBox. ObjectCollectio n.Add(object item)

    and it will Call : System.Windows. Forms.ListBox.O bjectCollection .AddInternal(ob ject item)

    and it will Call : System.Windows. Forms.ListBox.N ativeAdd(object item)

    and it will call : System.Windows. Forms.ListContr ol.GetItemText( object item)

    and it will call : System.Windows. Forms.Formatter .FormatObject(o bject value, System.Type targetType, System.Componen tModel.TypeConv erter sourceConverter , System.Componen tModel.TypeConv erter targetConverter , string formatString, System.IFormatP rovider formatInfo, object formattedNullVa lue, object dataSourceNullV alue)

    and it will call :System.Windows .Forms.Formatte r.IsNullData(ob ject value, object dataSourceNullV alue)


    and Finally it will call : object.Equals(o bject objA, object objB)


    which This Method Make My Equal Method too Run :

    WindowsFormsApp lication1.Stude nt.Equals(objec t obj)


    and The Last Parameter which Will be Send to My Equals Method (as obj) is a DBNULL Object !
    what is a DBNULL ?

    Comment

    Working...