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
// Instances of this class are not thread-safe | |
// E.g. only one thread can safely call Save and DisposeAsync | |
// | |
interface IAsyncSaveService { | |
// this function schedules save operation to be performed | |
// implementers of this interface must ensure, that only one save operation can run at the same time | |
// saveOperation is considered completed when the task it returned is completed | |
void Save(Func<Task> saveOperation); | |
// after a call to this function no calls to Save are allowed and must throw ObjectDisposedException | |
// this function can be called any number of times |
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.Diagnostics; | |
using System.IO; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Security.AccessControl; | |
IPAddress GetMyExternalIpAddress() { | |
var dnsQuery = new ProcessStartInfo("nslookup", "myip.opendns.com. resolver1.opendns.com") | |
{ |
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
// License: MIT | |
using System; | |
using System.Collections.Concurrent; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
public class LifeSpanTreadmill: IDisposable | |
{ |
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
namespace FormattingTest | |
{ | |
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.Formatting; |
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 Python.Runtime; | |
class MyNonGenericTree | |
{ | |
} | |
PyTypeConversion<MyNonGenericTree>.Converter = tree => ...; | |
class MyTree<T> | |
{ |
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
namespace Inline_vs_Static_Readonly | |
{ | |
using System; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Running; | |
[SimpleJob(RuntimeMoniker.Net48)] | |
[SimpleJob(RuntimeMoniker.Mono)] | |
[SimpleJob(RuntimeMoniker.NetCoreApp31)] | |
public class InlineOrStaticReadonly |
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
class List: | |
def add(self, item): ... | |
class ListMixin: | |
def append(self, item): return self.add(item) | |
def mix_in(target_type, mixin): | |
??? | |
mix_in(List, ListMixin) |
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
>>> class MyList(list): | |
... def __getitem__(self, idx): | |
... print('hello') | |
... return super().__getitem__(idx) | |
... | |
>>> l = MyList() | |
>>> l.append(42) | |
>>> l[0] | |
hello | |
42 |
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
<zones:Zone.Style> | |
<Style> | |
<Style.Triggers> | |
<DataTrigger Binding="{Binding IsChecked, ElementName=StackLeftSide}" Value="True"> | |
<Setter Property="zones:Zone.Layout"> | |
<Setter.Value> | |
<ItemsPanelTemplate> | |
<UniformGrid Columns="1" /> | |
</ItemsPanelTemplate> | |
</Setter.Value> |
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
<zones:Zone.Style> | |
<Style> | |
<Style.Triggers> | |
<DataTrigger Binding="{Binding IsChecked, ElementName=StackLeftSide}" Value="True"> | |
<Setter Property="zones:Zone.Layout"> | |
<Setter.Value> | |
<ItemsPanelTemplate> | |
<UniformGrid Columns="1" /> | |
</ItemsPanelTemplate> | |
</Setter.Value> |
OlderNewer