This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace TaskWithRetry | |
{ | |
internal class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See https://aka.ms/new-console-template for more information | |
Console.WriteLine("Hello, World!"); | |
MyStack<MyItem> stack = new MyStack<MyItem>(); | |
public class MyStack<T> where T : class | |
{ | |
private T[] _items; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Reactive.Linq; | |
using System.Text; | |
using System.Xml.Linq; | |
namespace TwitterSearcher | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Actor inherits from the ActorPolicy class. | |
class TestActor : public Actors::ActorPolicy | |
{ | |
public: | |
TestActor() : ActorPolicy{} | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST(SimpleActorTest, WhenUsingAsyncStatefulActorThenHasExpectedState) | |
{ | |
const int MESSAGES_COUNT = 101; | |
const int EXPECTED_STATE = MESSAGES_COUNT; | |
auto seenMessages = 0; | |
auto testState = 0; | |
{ | |
//Create the actor (asynchronous logic/with state/no reply). | |
auto stateFullActor = RStein::AsyncCpp::Actors::CreateAsyncSimpleActor<int, int>([&seenMessages, &testState](const int& message, const int& state)->Task<int> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tasks::Task<size_t> WhenAsyncForkJoinDataflowThenAllInputsProcessedImpl(int inputItemsCount) | |
{ | |
//Create TransformBlock. As the name of the block suggests, TransformBlock transforms input to output. | |
//Following block transforms int to string. | |
auto transform1 = DataFlowAsyncFactory::CreateTransformBlock<int, int>([](const int& item)-> Tasks::Task<int> | |
{ | |
//Simulate work | |
co_await Tasks::GetCompletedTask(); | |
auto message = "int: " + to_string(item) + "\n"; | |
cout << message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ts = myAgentList.ToObservable().Concat( | |
Observable.FromEventPattern | |
<NotifyCollectionChangedEventHandler, NotifyCollectionChangedEventArgs> | |
( | |
handler => myAgentList.CollectionChanged += handler, | |
handler => myAgentList.CollectionChanged -= handler | |
) | |
.Where(e => e.EventArgs.Action == NotifyCollectionChangedAction.Add) | |
.SelectMany(c => c.EventArgs.NewItems.Cast<MyAgent>())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://twitter.com/jechtom/status/326325740503175169 | |
using System; | |
using System.Threading; | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Console.Error.WriteLine("Dummy error init"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Dynamic; | |
using System.Globalization; | |
using System.Linq; | |
using System.Security.AccessControl; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Mormegill_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://twitter.com/mormegil_cz/status/321991296019484672 | |
using System; | |
using System.Collections.Generic; | |
using System.Dynamic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Mormegill_test | |
{ |
NewerOlder