private static int IndexOf(IList list, object item, StringComparison comparisonType)
 {
     if ((item is string || item is ProxyAddressBase) && typeof(T).GetTypeInfo().IsAssignableFrom(item.GetType().GetTypeInfo()))
     {
         if (item is string)
         {
             string a = item.ToString();
             for (int i = 0; i < list.Count; i++)
             {
                 string b = list[i].ToString();
                 if (string.Equals(a, b, comparisonType))
                 {
                     return(i);
                 }
             }
         }
         else if (item is ProxyAddressBase)
         {
             ProxyAddressBase a2 = (ProxyAddressBase)item;
             for (int j = 0; j < list.Count; j++)
             {
                 ProxyAddressBase b2 = (ProxyAddressBase)list[j];
                 if (ProxyAddressBase.Equals(a2, b2, comparisonType))
                 {
                     return(j);
                 }
             }
         }
         return(-1);
     }
     return(list.IndexOf(item));
 }
Beispiel #2
0
 internal static bool Equals(object obj1, object obj2, StringComparison comparisonType)
 {
     if (obj1 is string)
     {
         return(string.Equals(obj1 as string, obj2 as string, comparisonType));
     }
     if (obj1 is ProxyAddressBase)
     {
         return(ProxyAddressBase.Equals(obj1 as ProxyAddressBase, obj2 as ProxyAddressBase, comparisonType));
     }
     return(object.Equals(obj1, obj2));
 }