Comments (4)
Also, I will remove the CodeContracts stuff.
from itask.
I have verified that generalized return types allow one to write code like this:
[Test]
public async Task TaskInterfaceAsyncMethodBuilderTask()
{
await TaskInterfaceAsyncMethodBuilderTaskMethodAsync().ConfigureAwait(false);
}
async ITask TaskInterfaceAsyncMethodBuilderTaskMethodAsync()
{
await Task.Delay(50).ConfigureAwait(false);
}
[Test]
public async Task TaskInterfaceAsyncMethodBuilderResultTask()
{
var value = await TaskInterfaceAsyncMethodBuilderResultTaskMethodAsync().ConfigureAwait(false);
Assert.AreEqual(3, value);
}
async ITask<int> TaskInterfaceAsyncMethodBuilderResultTaskMethodAsync()
{
var results = await Task.WhenAll(
Enumerable.Range(0, 3).Select(async i =>
{
await Task.Delay(i);
return i;
}));
return results.Length;
}
I’m about to submit a PR, but it is quite ugly because I don’t know how to use CodeContracts (and supposedly it doesn’t work with VS-2017/roslyn anyway because roslyn generated IL that is different from the old compilers, causing ccrewrite to fail to do things). Please review it and let me know if I can do things to make it work or if you can get the buildsystem to be compatible with VS-2017 and I can rebase my patches.
from itask.
Thanks for this! I have been meaning to look into this but I also was under the impression that interfaces were not supported. That's great to hear that they are!
I will update AppVeyor to use Visual Studio 2017 to build.
from itask.
Awesome! Let me know when you're done and I can try to fix my commits/PR. I noticed I messed up the newlines of the README and I probably need to fix the .cs files to follow project newline conventions and license headers, etc. I'll fix that all after you make your changes. Alternatively, feel free to just copy and paste the implementation over—I don't care that much about commits being in my name ;-).
from itask.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itask.