8000 Add FileSystemEnumerable usage example by carlossanlop · Pull Request #5245 · dotnet/dotnet-api-docs · GitHub
[go: up one dir, main page]

Skip to content

Add FileSystemEnumerable usage example #5245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 20, 2021

Conversation

carlossanlop
Copy link
Contributor

I noticed this class has no examples, so I added one with basic filtering options. Whenever I get a chance, I'll write additional examples with more advanced filters.

@carlossanlop carlossanlop added doc-enhancement Improve the current content area-System.IO labels Jan 16, 2021
@carlossanlop carlossanlop self-assigned this Jan 16, 2021
@@ -35,7 +35,17 @@
<Docs>
<typeparam name="TResult">The type that this enumerable encapsulates.</typeparam>
<summary>Allows utilizing custom filter predicates and transform delegates for enumeration purposes.</summary>
<remarks>To be added.</remarks>
<remarks>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to put the example in the remarks of the type, because I think it's the most visible place.

Comment on lines 39 to 44
static string myTransform(ref FileSystemEntry entry) =>
entry.ToFullPath();

static bool myPredicate(ref FileSystemEntry entry) =>
!entry.IsDirectory &&
Path.GetExtension(entry.ToFullPath()).Equals(".txt", StringComparison.InvariantCultureIgnoreCase);
Copy link
Contributor Author
@carlossanlop carlossanlop Jan 16, 2021

Choose a reason for hiding this comment

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

I tried to write the same example in Visual Basic but the predicate and the transform were giving me headaches. I know there are no local methods in VB, but I couldn't figure out the syntax for the delegate with a ByRef argument. I'll give it another try soon.

Also, I was getting a build failure when trying to use ByRef FileSystemEntry:

FileSystemEntry' is obsolete: 'Types with embedded references are not supported in this version of your compiler.

I'll ask someone in my team why this is happening.

@opbld34
Copy link
opbld34 commented Jan 16, 2021

Docs Build status updates of commit 047e2c5:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_CLR/IO.Enumeration.FileSystemEnumerable/CS/Sample1.cs ✅Succeeded View
xml/System.IO.Enumeration/FileSystemEnumerable`1.xml ✅Succeeded View

For more details, please refer to the build report.

8000 Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@opbld34
Copy link
opbld34 commented Jan 16, 2021

Docs Build status updates of commit 1b50097:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_CLR/IO.Enumeration.FileSystemEnumerable/CS/Sample1.cs ✅Succeeded View
xml/System.IO.Enumeration/FileSystemEnumerable`1.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@opbld32
Copy link
opbld32 commented Jan 16, 2021

Docs Build status updates of commit 120eb24:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_CLR/IO.Enumeration.FileSystemEnumerable/CS/Sample1.cs ✅Succeeded View
xml/System.IO.Enumeration/FileSystemEnumerable`1.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

Copy link
Contributor
@gewarren gewarren left a comment

Choose a reason for hiding this comment

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

LGTM

…temEnumerable/CS/Sample1.cs

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
@opbld32
Copy link
opbld32 commented Jan 20, 2021

Docs Build status updates of commit 374c58d:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_CLR/IO.Enumeration.FileSystemEnumerable/CS/Sample1.cs ✅Succeeded View
xml/System.IO.Enumeration/FileSystemEnumerable`1.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

Copy link
Member
@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM!

@opbld32
Copy link
opbld32 commented Jan 20, 2021

Docs Build status updates of commit 26e5797:

✅ Validation status: passed

File Status Preview URL Details
samples/snippets/csharp/VS_Snippets_CLR/IO.Enumeration.FileSystemEnumerable/CS/Sample1.cs ✅Succeeded View
xml/System.IO.Enumeration/FileSystemEnumerable`1.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@carlossanlop carlossanlop merged commit d42a733 into dotnet:master Jan 20, 2021
@carlossanlop carlossanlop deleted the FSEnumerableExample branch January 20, 2021 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO doc-enhancement Improve the current content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0