Skip to content

kpocza/GoSharp

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
go
 
 
src
 
 
 
 
 
 
 
 
 
 

Go# project

Go-like DSL for C#

This library provides a mini embedded DSL for C# that mimics Go concurrency statements like channels, select, timers and tickers.

In addition some higher level constructs (merge, zip, buffer, broadcast, pipeline, etc.) are also supported based on the core features of GoSharp.

The official NuGet package called GoSharp is hosted by nuget.org and supports .NET Standard 2.0 (.NET Core 2.0, .NET Framework 4.6.1) and .NET Framework 4.5.2.

For example the following Go code

func sendRecv() {
	messages := make(chan string)

	go func() { 
		messages <- "ping"
	}()
	
	msg := <-messages
	fmt.Println(msg)
}

looks like this way in C# powered by Go#:

private async Task sendRecv()
{
    var messages = Channel<string>.CreateNonBuffered();

    Go.Run(async () =>
    {
        await messages.SendAsync("ping");
    });

    var msg = await messages.RecvAsync();
    Console.WriteLine(msg);
}

For more examples and detailed explanation go here.

For examples of high-level constructs go here.

TODO:

  • More Pipeline features

About

Go-like DSL for C#

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages