I need the following calls possible within the same portable class library:
public class Foobar
{
void Foo()
{
var b = GetType().IsValueType; //<-- 2
}
async Task<IEnumerable<T>> Bar<T>()
where T : class, IBaz, new()
{
return await Task.Factory.StartNew(() => new List<T>(new[] //<-- 1
{
new T {Qux = Guid.NewGuid().ToString()}
}));
}
interface IBaz
{
string Qux { get; set; }
}
}
With the following target frameworks set:
I get this build error:
Cannot find all types required by the 'async' modifier. Are you targeting the wrong framework version, or missing a reference to an assembly?
I tried to install the bcl but still get the same error. And if I remove the Sliverlight target the async works but then I lose the IsValueType prop from the Type class...
You need to install Microsoft.Bcl.Async.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With