We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello.
I try to use IEnumerable.ToDynamicListAsync(Type type). So, it's not cast to my custom type (for example, I have problem with casting to strings).
IEnumerable.ToDynamicListAsync(Type type)
I checked your code and possible found the reason of this unbehavior definition:
you have
public static Task<List<dynamic>> ToDynamicListAsync([NotNull] this IEnumerable source, [NotNull] Type type) { Check.NotNull(source, nameof(source)); Check.NotNull(type, nameof(type)); return Task.Run(() => source.ToDynamicList()); }
instead (possible) of
public static Task<List<dynamic>> ToDynamicListAsync([NotNull] this IEnumerable source, [NotNull] Type type) { Check.NotNull(source, nameof(source)); Check.NotNull(type, nameof(type)); return Task.Run(() => **source.ToDynamicList(type));** }
This possible error was also found in ToDynamicArrayAsync([NotNull] this IEnumerable source, [NotNull] Type type)
ToDynamicArrayAsync([NotNull] this IEnumerable source, [NotNull] Type type)
The text was updated successfully, but these errors were encountered:
When the object is a string, only then you can cast it to string!
Example:
var result = new List<string> { "x", "x2" }.ToDynamicList(typeof(string));
Sorry, something went wrong.
see also https://github.com/StefH/System.Linq.Dynamic.Core/blob/5863256c11e32b100c917d133c54bda4afae4d8a/test/System.Linq.Dynamic.Core.Tests/DynamicEnumerableExtensionsTests.cs
StefH, I know, I've just wanted to show that in your code you have problem only in async cast methods.
return Task.Run(() => source.ToDynamicList()); <--- this code do not make any casts to the asked type.
Ah I see. This needs to be fixed.
No branches or pull requests
Hello.
I try to use
IEnumerable.ToDynamicListAsync(Type type)
. So, it's not cast to my custom type (for example, I have problem with casting to strings).I checked your code and possible found the reason of this unbehavior definition:
you have
instead (possible) of
This possible error was also found in
ToDynamicArrayAsync([NotNull] this IEnumerable source, [NotNull] Type type)
The text was updated successfully, but these errors were encountered: