Bot 🤖 generated CleanRepo tool run (#35203)
Co-authored-by: IEvangelist <IEvangelist@users.noreply.github.com> Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
This commit is contained in:
Родитель
1ade14dd4c
Коммит
09757df88f
|
@ -1,53 +0,0 @@
|
|||
using System;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Example
|
||||
{
|
||||
// <Snippet1>
|
||||
// An acceptable implementation.
|
||||
static void Log(ReadOnlyMemory<char> message)
|
||||
{
|
||||
// Run in the background so that we don't block the main thread while performing IO.
|
||||
Task.Run(() => {
|
||||
string defensiveCopy = message.ToString();
|
||||
StreamWriter sw = File.AppendText(@".\input-numbers.dat");
|
||||
sw.WriteLine(defensiveCopy);
|
||||
sw.Flush();
|
||||
});
|
||||
}
|
||||
// </Snippet1>
|
||||
|
||||
// user code
|
||||
public static void Main()
|
||||
{
|
||||
using (var owner = MemoryPool<char>.Shared.Rent())
|
||||
{
|
||||
var memory = owner.Memory;
|
||||
var span = memory.Span;
|
||||
while (true)
|
||||
{
|
||||
string? s = Console.ReadLine();
|
||||
|
||||
if (s is null)
|
||||
return;
|
||||
|
||||
int value = Int32.Parse(s);
|
||||
if (value < 0)
|
||||
return;
|
||||
|
||||
int numCharsWritten = ToBuffer(value, span);
|
||||
Log(memory.Slice(0, numCharsWritten));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int ToBuffer(int value, Span<char> span)
|
||||
{
|
||||
string strValue = value.ToString();
|
||||
int length = strValue.Length;
|
||||
strValue.AsSpan().CopyTo(span.Slice(0, length));
|
||||
return length;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>void_returning</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -1,15 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.LayoutWindow"
|
||||
Title="Layout with the DockPanel" Height="143" Width="319">
|
||||
|
||||
<!--DockPanel to layout four text boxes-->
|
||||
<DockPanel>
|
||||
<TextBox DockPanel.Dock="Top">Dock = "Top"</TextBox>
|
||||
<TextBox DockPanel.Dock="Bottom">Dock = "Bottom"</TextBox>
|
||||
<TextBox DockPanel.Dock="Left">Dock = "Left"</TextBox>
|
||||
<TextBox Background="White">This TextBox "fills" the remaining space.</TextBox>
|
||||
</DockPanel>
|
||||
|
||||
</Window>
|
|
@ -1,5 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.TextBoxContentWindow"
|
||||
Title="TextBox Content">
|
|
@ -1 +0,0 @@
|
|||
<TextBox Text="This is the content of a TextBox." />
|
|
@ -1 +0,0 @@
|
|||
</Window>
|
|
@ -1,5 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.ButtonContentWindow"
|
||||
Title="Button Content">
|
|
@ -1,10 +0,0 @@
|
|||
<Button Margin="20">
|
||||
<!-- Button Content -->
|
||||
<DockPanel Width="200" Height="180">
|
||||
<Label DockPanel.Dock="Top" HorizontalAlignment="Center">Click Me!</Label>
|
||||
<Border Background="Black" BorderBrush="Yellow" BorderThickness="2"
|
||||
CornerRadius="2" Margin="5">
|
||||
<MediaElement Source="media/wpf.wmv" Stretch="Fill" />
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</Button>
|
|
@ -1 +0,0 @@
|
|||
</Window>
|
|
@ -1,28 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.ControlTemplateButtonWindow"
|
||||
Title="Button with Control Template" Height="158" Width="290">
|
||||
|
||||
<!-- Button using an ellipse -->
|
||||
<Button Content="Click Me!" Click="button_Click">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Grid Margin="5">
|
||||
<Ellipse Stroke="DarkBlue" StrokeThickness="2">
|
||||
<Ellipse.Fill>
|
||||
<RadialGradientBrush Center="0.3,0.2" RadiusX="0.5" RadiusY="0.5">
|
||||
<GradientStop Color="Azure" Offset="0.1" />
|
||||
<GradientStop Color="CornflowerBlue" Offset="1.1" />
|
||||
</RadialGradientBrush>
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
<ContentPresenter Name="content" HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
|
||||
</Button>
|
||||
|
||||
</Window>
|
|
@ -1,5 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.DataTemplateWindow"
|
||||
Title="With a Data Template">
|
|
@ -1,25 +0,0 @@
|
|||
<Window.Resources>
|
||||
<!-- Data Template (applied to each bound task item in the task collection) -->
|
||||
<DataTemplate x:Key="myTaskTemplate">
|
||||
<Border Name="border" BorderBrush="DarkSlateBlue" BorderThickness="2"
|
||||
CornerRadius="2" Padding="5" Margin="5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Padding="0,0,5,0" Text="Task Name:"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=TaskName}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Padding="0,0,5,0" Text="Description:"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Description}"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Padding="0,0,5,0" Text="Priority:"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Priority}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
|
@ -1,14 +0,0 @@
|
|||
<!-- UI -->
|
||||
<DockPanel>
|
||||
<!-- Title -->
|
||||
<Label DockPanel.Dock="Top" FontSize="18" Margin="5" Content="My Task List:"/>
|
||||
|
||||
<!-- Data template is specified by the ItemTemplate attribute -->
|
||||
<ListBox
|
||||
ItemsSource="{Binding}"
|
||||
ItemTemplate="{StaticResource myTaskTemplate}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
Margin="5,0,5,5" />
|
||||
|
||||
</DockPanel>
|
|
@ -1 +0,0 @@
|
|||
</Window>
|
|
@ -1,5 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.StyleWindow"
|
||||
Title="Styles">
|
|
@ -1,8 +0,0 @@
|
|||
<!-- Style that will be applied to all buttons -->
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Background" Value="Orange" />
|
||||
<Setter Property="BorderBrush" Value="Crimson" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Margin" Value="5" />
|
||||
</Style>
|
|
@ -1,8 +0,0 @@
|
|||
<!-- This button will have the style applied to it -->
|
||||
<Button>Click Me!</Button>
|
||||
|
||||
<!-- This label will not have the style applied to it -->
|
||||
<Label>Don't Click Me!</Label>
|
||||
|
||||
<!-- This button will have the style applied to it -->
|
||||
<Button>Click Me!</Button>
|
|
@ -1 +0,0 @@
|
|||
</Window>
|
|
@ -1,10 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.ResourcesWindow"
|
||||
Title="Resources Window">
|
||||
|
||||
<!-- Define window-scoped background color resource -->
|
||||
<Window.Resources>
|
||||
<SolidColorBrush x:Key="defaultBackground" Color="Red" />
|
||||
</Window.Resources>
|
|
@ -1,5 +0,0 @@
|
|||
<!-- Button background is defined by window-scoped resource -->
|
||||
<Button Background="{StaticResource defaultBackground}">One Button</Button>
|
||||
|
||||
<!-- Label background is defined by window-scoped resource -->
|
||||
<Label Background="{StaticResource defaultBackground}">One Label</Label>
|
|
@ -1 +0,0 @@
|
|||
</Window>
|
|
@ -1,8 +0,0 @@
|
|||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<!-- Define background color resource -->
|
||||
<SolidColorBrush x:Key="defaultBackground" Color="Red" />
|
||||
|
||||
<!-- Define other resources -->
|
|
@ -1,4 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.DataBindingWindow">
|
|
@ -1 +0,0 @@
|
|||
</ResourceDictionary>
|
|
@ -1,12 +0,0 @@
|
|||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.App">
|
||||
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="BackgroundColorResources.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
|
@ -1 +0,0 @@
|
|||
</Application>
|
|
@ -1,31 +0,0 @@
|
|||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.NumericUpDown">
|
||||
|
||||
<Grid>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Value text box -->
|
||||
<Border BorderThickness="1" BorderBrush="Gray" Margin="2" Grid.RowSpan="2"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch">
|
||||
<TextBlock Name="valueText" Width="60" TextAlignment="Right" Padding="5"/>
|
||||
</Border>
|
||||
|
||||
<!-- Up/Down buttons -->
|
||||
<RepeatButton Name="upButton" Click="upButton_Click" Grid.Column="1"
|
||||
Grid.Row="0">Up</RepeatButton>
|
||||
<RepeatButton Name="downButton" Click="downButton_Click" Grid.Column="1"
|
||||
Grid.Row="1">Down</RepeatButton>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
|
@ -1,11 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.UserControlWindow"
|
||||
xmlns:local="clr-namespace:SDKSample"
|
||||
Title="User Control Window">
|
||||
|
||||
<!-- Numeric Up/Down user control -->
|
||||
<local:NumericUpDown />
|
||||
|
||||
</Window>
|
|
@ -1,2 +0,0 @@
|
|||
<!-- Bind the TextBox to the data source (TextBox.Text to Person.Name) -->
|
||||
<TextBox Name="personNameTextBox" Text="{Binding Path=Name}" />
|
|
@ -1 +0,0 @@
|
|||
</Window>
|
|
@ -1,7 +0,0 @@
|
|||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.EllipseEventHandlingWindow"
|
||||
Title="Click the Ellipse">
|
||||
<Ellipse Name="clickableEllipse" Fill="Blue" MouseUp="clickableEllipse_MouseUp" />
|
||||
</Window>
|
|
@ -1,5 +0,0 @@
|
|||
<MediaElement
|
||||
Name="myMediaElement"
|
||||
Source="media/wpf.wmv"
|
||||
LoadedBehavior="Manual"
|
||||
Width="350" Height="250" />
|
Загрузка…
Ссылка в новой задаче