mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-19 01:31:17 -10:00
Adding reference source for System.Data System.Data.DataSetExtensions System.Data.Entity System.Data.Entity.Design System.Data.Linq System.Data.SqlXml System.ServiceModel System.ServiceModel.Activation System.ServiceModel.Activities System.ServiceModel.Channels System.ServiceModel.Discovery System.ServiceModel.Internals System.ServiceModel.Routing System.ServiceModel.WasHosting System.ServiceModel.Web System.Web System.Web.ApplicationServices System.Web.DynamicData System.Web.Entity System.Web.Entity.Design System.Web.Extensions System.Web.Mobile System.Web.Routing System.Web.Services System.Xml System.Xml.Linq
48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
namespace System.Web.UI.WebControls {
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
|
|
internal class LinqDataSourceHelper {
|
|
|
|
public static bool EnumerableContentEquals(IEnumerable enumerableA, IEnumerable enumerableB) {
|
|
IEnumerator enumeratorA = enumerableA.GetEnumerator();
|
|
IEnumerator enumeratorB = enumerableB.GetEnumerator();
|
|
while (enumeratorA.MoveNext()) {
|
|
if (!enumeratorB.MoveNext())
|
|
return false;
|
|
object itemA = enumeratorA.Current;
|
|
object itemB = enumeratorB.Current;
|
|
if (itemA == null) {
|
|
if (itemB != null)
|
|
return false;
|
|
}
|
|
else if (!itemA.Equals(itemB))
|
|
return false;
|
|
}
|
|
if (enumeratorB.MoveNext())
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
public static Type FindGenericEnumerableType(Type type) {
|
|
// Logic taken from Queryable.AsQueryable which accounts for Array types which are not
|
|
// generic but implement the generic IEnumerable interface.
|
|
while ((type != null) && (type != typeof(object)) && (type != typeof(string))) {
|
|
if (type.IsGenericType && (type.GetGenericTypeDefinition() == typeof(IEnumerable<>))) {
|
|
return type;
|
|
}
|
|
foreach (Type interfaceType in type.GetInterfaces()) {
|
|
Type genericInterface = FindGenericEnumerableType(interfaceType);
|
|
if (genericInterface != null) {
|
|
return genericInterface;
|
|
}
|
|
}
|
|
type = type.BaseType;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
}
|