-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created new sandbox project for working on documentation samples
- Loading branch information
1 parent
0b46cb0
commit 91b6842
Showing
5 changed files
with
99 additions
and
14 deletions.
There are no files selected for viewing
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
10 changes: 10 additions & 0 deletions
10
src/Extended.Collections.Playground/Extended.Collections.Playground.csproj
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
34 changes: 34 additions & 0 deletions
34
src/Extended.Collections.Playground/Generic/RingBufferSandbox.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Extended.Collections.Generic; | ||
|
||
namespace Extended.Collections.Playground.Generic | ||
{ | ||
public class RingBufferSandbox : Sandbox | ||
{ | ||
private readonly RingBuffer<string> m_buffer; | ||
|
||
public RingBufferSandbox() | ||
{ | ||
m_buffer = new RingBuffer<string>(3); | ||
} | ||
|
||
protected override void Run() | ||
{ | ||
m_buffer.Add("A"); | ||
m_buffer.Add("B"); | ||
m_buffer.Add("C"); | ||
Logger.Information("1. {Buffer}", m_buffer); // 1. [ "A", "B", "C" ] | ||
|
||
m_buffer.Add("D"); | ||
Logger.Information("2. {Buffer}", m_buffer); // 2. [ "B", "C", "D" ] | ||
|
||
m_buffer.Remove("C"); | ||
Logger.Information("3. {Buffer}", m_buffer); // 3. [ "B", "D" ] | ||
|
||
m_buffer.Add("E"); | ||
Logger.Information("4. {Buffer}", m_buffer); // 4. [ "B", "D", "E" ] | ||
|
||
m_buffer.Clear(); | ||
Logger.Information("5. {Buffer}", m_buffer); // [ ] | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Extended.Collections.Playground | ||
{ | ||
internal class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
Console.WriteLine("Hello, World!"); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Serilog; | ||
|
||
namespace Extended.Collections.Playground | ||
{ | ||
public abstract class Sandbox | ||
{ | ||
public ILogger Logger { get; } | ||
|
||
protected Sandbox() | ||
{ | ||
Logger = new LoggerConfiguration() | ||
.WriteTo.Console() | ||
.CreateLogger(); | ||
} | ||
|
||
protected abstract void Run(); | ||
} | ||
} |