Skip to content

Instantly share code, notes, and snippets.

View marcinnajder's full-sized avatar

MarcinNajder marcinnajder

View GitHub Profile
async Optional<string> ProcessText(string text1, string text2)
{
int number1 = await TryParseInt(text1);
int number2 = await TryParseInt(text2);
return (number1 + number2).ToString();
}
Optional<int> TryParseInt(string text) =>
int.TryParse(text, out var result) ? new Optional<int>(result) : Optional<int>.None;
async Optional<string> ProcessText(string text1, string text2)
{
int number1 = await TryParseInt(text1);
int number2 = await TryParseInt(text2);
return (number1 + number2).ToString();
}
Optional<int> TryParseInt(string text) =>
int.TryParse(text, out var result) ? new Optional<int>(result) : Optional<int>.None;
class Program
{
static void ExecuteAcionNTimes(int n, Action<int> cosDoZrobienia)
{
for (int i = 0; i < n; i++)
{
cosDoZrobienia.Invoke(i);
}
}
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Threading;
using System.IO;
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Workshop.CSharp.Advanced.Tests")]
using System;
//using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Threading;
using System.IO;
using System.Linq;