Skip to content

Commit bdc1ec6

Browse files
authored
Rename extension method "AsEnumerable" to "AsDynamicEnumerable". (#642)
1 parent c27ebb7 commit bdc1ec6

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/System.Linq.Dynamic.Core/DynamicQueryableExtensions.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -281,29 +281,29 @@ public static double Average(this IQueryable source, LambdaExpression lambda)
281281
}
282282
#endregion Average
283283

284-
#region AsEnumerable
284+
#region AsDynamicEnumerable
285285
#if NET35
286286
/// <summary>
287287
/// Returns the input typed as <see cref="IEnumerable{T}"/> of <see cref="object"/>./>
288288
/// </summary>
289289
/// <param name="source">The sequence to type as <see cref="IEnumerable{T}"/> of <see cref="object"/>.</param>
290290
/// <returns>The input typed as <see cref="IEnumerable{T}"/> of <see cref="object"/>.</returns>
291-
public static IEnumerable<object> AsEnumerable(this IQueryable source)
291+
public static IEnumerable<object> AsDynamicEnumerable(this IQueryable source)
292292
#else
293293
/// <summary>
294294
/// Returns the input typed as <see cref="IEnumerable{T}"/> of dynamic.
295295
/// </summary>
296296
/// <param name="source">The sequence to type as <see cref="IEnumerable{T}"/> of dynamic.</param>
297297
/// <returns>The input typed as <see cref="IEnumerable{T}"/> of dynamic.</returns>
298-
public static IEnumerable<dynamic> AsEnumerable(this IQueryable source)
298+
public static IEnumerable<dynamic> AsDynamicEnumerable(this IQueryable source)
299299
#endif
300300
{
301301
foreach (var obj in source)
302302
{
303303
yield return obj;
304304
}
305305
}
306-
#endregion AsEnumerable
306+
#endregion AsDynamicEnumerable
307307

308308
#region Cast
309309
private static readonly MethodInfo _cast = QueryableMethodFinder.GetGenericMethod(nameof(Queryable.Cast));

test/System.Linq.Dynamic.Core.Tests/ComplexTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ public void GroupByAndSelect_TestDynamicSelectMember()
111111
#else
112112
Assert.Equal(
113113
realQry.Select(x => x.Age).ToArray(),
114-
selectQry.AsEnumerable().Select(x => x.Age).Cast<int?>().ToArray());
114+
selectQry.AsDynamicEnumerable().Select(x => x.Age).Cast<int?>().ToArray());
115115

116116
Assert.Equal(
117117
realQry.Select(x => x.TotalIncome).ToArray(),
118-
selectQry.AsEnumerable().Select(x => x.TotalIncome).Cast<int>().ToArray());
118+
selectQry.AsDynamicEnumerable().Select(x => x.TotalIncome).Cast<int>().ToArray());
119119
#endif
120120
}
121121
}

test/System.Linq.Dynamic.Core.Tests/ExpressionTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2180,7 +2180,7 @@ public void ExpressionTests_Sum()
21802180
var qry = initValues.AsQueryable().Select(x => new { strValue = "str", intValue = x }).GroupBy(x => x.strValue);
21812181

21822182
// Act
2183-
var result = qry.Select("Sum(intValue)").AsEnumerable().ToArray()[0];
2183+
var result = qry.Select("Sum(intValue)").AsDynamicEnumerable().ToArray()[0];
21842184

21852185
// Assert
21862186
Assert.Equal(15, result);
@@ -2194,7 +2194,7 @@ public void ExpressionTests_Sum_LowerCase()
21942194
var qry = initValues.AsQueryable().Select(x => new { strValue = "str", intValue = x }).GroupBy(x => x.strValue);
21952195

21962196
// Act
2197-
var result = qry.Select("sum(intValue)").AsEnumerable().ToArray()[0];
2197+
var result = qry.Select("sum(intValue)").AsDynamicEnumerable().ToArray()[0];
21982198

21992199
// Assert
22002200
Assert.Equal(15, result);

test/System.Linq.Dynamic.Core.Tests/QueryableTests.Select.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void Select_Dynamic3()
142142
Assert.Equal(testList.Select(x => x.UserName).ToArray(), userNames.Cast<string>().ToArray());
143143
Assert.Equal(
144144
testList.Select(x => "{ UserName = " + x.UserName + ", MyFirstName = " + x.Profile.FirstName + " }").ToArray(),
145-
userFirstName.AsEnumerable().Select(x => x.ToString()).Cast<string>().ToArray());
145+
userFirstName.AsDynamicEnumerable().Select(x => x.ToString()).Cast<string>().ToArray());
146146
Assert.Equal(testList[0].Roles.Select(x => x.Id).ToArray(), Enumerable.ToArray(userRoles.First().RoleIds));
147147
#endif
148148
}

0 commit comments

Comments
 (0)