Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EnumerableQuery.cs
Go to the documentation of this file.
5
6namespace System.Linq;
7
8public abstract class EnumerableQuery
9{
10 internal abstract Expression Expression { get; }
11
12 internal abstract IEnumerable? Enumerable { get; }
13
14 internal EnumerableQuery()
15 {
16 }
17
18 [RequiresUnreferencedCode("Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.")]
24
25 [RequiresUnreferencedCode("Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.")]
31}
33{
34 private readonly Expression _expression;
35
37
38 IQueryProvider IQueryable.Provider => this;
39
40 internal override Expression Expression => _expression;
41
42 internal override IEnumerable? Enumerable => _enumerable;
43
44 Expression IQueryable.Expression => _expression;
45
46 Type IQueryable.ElementType => typeof(T);
47
48 [RequiresUnreferencedCode("Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.")]
54
55 [RequiresUnreferencedCode("Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime.")]
60
61 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This class's ctor is annotated as RequiresUnreferencedCode.")]
63 {
64 if (expression == null)
65 {
66 throw Error.ArgumentNull("expression");
67 }
69 if (type == null)
70 {
71 throw Error.ArgumentNotValid("expression");
72 }
73 return EnumerableQuery.Create(type.GetGenericArguments()[0], expression);
74 }
75
76 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This class's ctor is annotated as RequiresUnreferencedCode.")]
78 {
79 if (expression == null)
80 {
81 throw Error.ArgumentNull("expression");
82 }
83 if (!typeof(IQueryable<TElement>).IsAssignableFrom(expression.Type))
84 {
85 throw Error.ArgumentNotValid("expression");
86 }
88 }
89
90 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This class's ctor is annotated as RequiresUnreferencedCode.")]
92 {
93 if (expression == null)
94 {
95 throw Error.ArgumentNull("expression");
96 }
97 return EnumerableExecutor.Create(expression).ExecuteBoxed();
98 }
99
100 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This class's ctor is annotated as RequiresUnreferencedCode.")]
102 {
103 if (expression == null)
104 {
105 throw Error.ArgumentNull("expression");
106 }
107 if (!typeof(TElement).IsAssignableFrom(expression.Type))
108 {
109 throw Error.ArgumentNotValid("expression");
110 }
111 return new EnumerableExecutor<TElement>(expression).Execute();
112 }
113
118
123
124 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "This class's ctor is annotated as RequiresUnreferencedCode.")]
141
142 public override string? ToString()
143 {
145 {
146 if (_enumerable != null)
147 {
148 return _enumerable.ToString();
149 }
150 return "null";
151 }
152 return _expression.ToString();
153 }
154}
static ? object CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type, BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture)
Definition Activator.cs:17
static EnumerableExecutor Create(Expression expression)
static IQueryable Create(Type elementType, IEnumerable sequence)
IEnumerator IEnumerable. GetEnumerator()
static IQueryable Create(Type elementType, Expression expression)
readonly Expression _expression
EnumerableQuery(Expression expression)
EnumerableQuery(IEnumerable< T > enumerable)
IEnumerator< T > GetEnumerator()
static Exception ArgumentNotValid(string message)
Definition Error.cs:15
static Exception ArgumentNull(string message)
Definition Error.cs:5
static Exception EnumeratingNullEnumerableExpression()
Definition Error.cs:35
static ConstantExpression Constant(object? value)
static LambdaExpression Lambda(Expression body, params ParameterExpression[]? parameters)
static Type FindGenericType(Type definition, Type type)
Definition TypeHelper.cs:8
new IEnumerator< T > GetEnumerator()
IQueryable CreateQuery(Expression expression)
object? Execute(Expression expression)