Skip to content

Commit 7b5dc62

Browse files
committed
Обновление версий и эксперименты с методами-расширениями
1 parent ad464c5 commit 7b5dc62

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

Tests/MathCore.WPF.ConsoleTest/Program.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System.Threading.Channels;
22

3+
_ = Console.Out << "Bounded Channel Test" << Environment.NewLine;
4+
35
var sh = Channel.CreateBounded<int>(new BoundedChannelOptions(10)
46
{
57
AllowSynchronousContinuations = true,
@@ -36,3 +38,19 @@
3638

3739
Console.WriteLine("Completed");
3840
Console.ReadLine();
41+
42+
public static class TextWriterOperators
43+
{
44+
extension(TextWriter writer) // блок расширения для TextWriter
45+
{
46+
// Запись строки и возврат того же TextWriter для цепочек
47+
public static TextWriter operator <<(TextWriter Writer, string Value)
48+
{
49+
Writer.Write(Value); // записать значение
50+
return Writer; // вернуть для цепочки
51+
}
52+
53+
// Универсальный вариант для любых объектов
54+
public static TextWriter operator <<(TextWriter Writer, object? Value) => Writer << (Value?.ToString() ?? string.Empty);
55+
}
56+
}

Tests/MathCore.WPF.WindowTest/MathCore.WPF.WindowTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageReference Include="DotNetProjects.Extended.Wpf.Toolkit" Version="5.0.129" />
2828
<PackageReference Include="FontAwesome5" Version="2.1.11" />
2929
<PackageReference Include="FontAwesome6.Svg" Version="2.5.1" />
30-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
30+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
3131
<PackageReference Include="OxyPlot.Contrib.Wpf" Version="2.1.2" />
3232
<PackageReference Include="XPlot.Plotly" Version="4.1.0" />
3333
</ItemGroup>

0 commit comments

Comments
 (0)