Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Youssef1313 Because we define the same MainWindow class in example.cs and example3.cs and example4.cs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with EnableDefaultCompileItems being false is that it beats the purpose of the csproj, which is to make sure the code compiles properly. If the examples are completely independent, I'd make a folder for each of them, each with its own csproj. @IEvangelist Do you agree?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually example3 and example4 doesn't seem to be referenced. So they can just be deleted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IEvangelist Can I delete the example3.cs and example4.cs file and create the MainWindow2.xaml file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd have to verify that those two files are in fact not being referenced, if you can prove that then yes.

</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ public MainWindow()

private async void Button_Click(object sender, RoutedEventArgs e)
{
string StartDirectory = @"c:\Users\exampleuser\start";
string EndDirectory = @"c:\Users\exampleuser\end";
string startDirectory = @"c:\Users\exampleuser\start";
string endDirectory = @"c:\Users\exampleuser\end";

foreach (string filename in Directory.EnumerateFiles(StartDirectory))
foreach (string filename in Directory.EnumerateFiles(startDirectory))
{
using (FileStream SourceStream = File.Open(filename, FileMode.Open))
using (FileStream sourceStream = File.Open(filename, FileMode.Open))
{
using (FileStream DestinationStream = File.Create(EndDirectory + filename.Substring(filename.LastIndexOf('\\'))))
using (FileStream destinationStream = File.Create(Path.Combine(endDirectory, Path.GetFileName(filename))))
{
await SourceStream.CopyToAsync(DestinationStream);
await sourceStream.CopyToAsync(destinationStream);
}
}
}
}
}
}
//</snippet1>
//</snippet1>