-
Notifications
You must be signed in to change notification settings - Fork 5.1k
updating Guid.xml samples for Try .NET #1654
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
Conversation
snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor1.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor2.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/parseex1.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/parseexactex1.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseexactex1.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs
Outdated
Show resolved
Hide resolved
@WilliamAntonRohm I reviewed all these changes. I generally agree with @Youssef1313 's comments. You can apply those suggestions, and then this is ready to |
…r1.cs Co-Authored-By: Youssef Victor <[email protected]>
…r2.cs Co-Authored-By: Youssef Victor <[email protected]>
…pty.cs Co-Authored-By: Youssef Victor <[email protected]>
…rseex1.cs Co-Authored-By: Youssef Victor <[email protected]>
…rseexactex1.cs Co-Authored-By: Youssef Victor <[email protected]>
…yparseexactex1.cs Co-Authored-By: Youssef Victor <[email protected]>
…/cs/tobytearray3.cs Co-Authored-By: Youssef Victor <[email protected]>
…/cs/tobytearray3.cs Co-Authored-By: Youssef Victor <[email protected]>
…/cs/tobytearray3.cs Co-Authored-By: Youssef Victor <[email protected]>
@Youssef1313 -- Youssef, thank you for your helpful suggestions. I have applied them and I'll look for future such strings. @BillWagner -- Bill, please merge. |
snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor1.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @WilliamAntonRohm. The changes look great. Since we've started making changes to use var and string interpolation, I thought we should be consistent.
snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor2.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseexactex1.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseexactex1.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs
Outdated
Show resolved
Hide resolved
snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs
Outdated
Show resolved
Hide resolved
…r1.cs Co-Authored-By: Maira Wenzel <[email protected]>
…r2.cs Co-Authored-By: Maira Wenzel <[email protected]>
…pty.cs Co-Authored-By: Maira Wenzel <[email protected]>
…pty.cs Co-Authored-By: Maira Wenzel <[email protected]>
…pty.cs Co-Authored-By: Maira Wenzel <[email protected]>
…pty.cs Co-Authored-By: Maira Wenzel <[email protected]>
…yparseexactex1.cs Co-Authored-By: Maira Wenzel <[email protected]>
…yparseexactex1.cs Co-Authored-By: Maira Wenzel <[email protected]>
…/cs/tobytearray3.cs Co-Authored-By: Maira Wenzel <[email protected]>
…/cs/tobytearray3.cs Co-Authored-By: Maira Wenzel <[email protected]>
…/cs/tobytearray3.cs Co-Authored-By: Maira Wenzel <[email protected]>
…ng.cs Co-Authored-By: Maira Wenzel <[email protected]>
…ng.cs Co-Authored-By: Maira Wenzel <[email protected]>
…rseex1.cs Co-Authored-By: Maira Wenzel <[email protected]>
…rseexactex1.cs Co-Authored-By: Maira Wenzel <[email protected]>
…yparseex1.cs Co-Authored-By: Maira Wenzel <[email protected]>
…yparseexactex1.cs Co-Authored-By: Maira Wenzel <[email protected]>
You can apply all suggestions in bulk using the Files changed tab (https://github.com/dotnet/samples/pull/1654/files). |
Only the manual suggestions left and then we can merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @WilliamAntonRohm!
@mairaw -- Maira, thanks for that tip! I believe these samples are all ready to go now. |
foreach (var stringGuid in stringGuids) { | ||
if (Guid.TryParse(stringGuid, out newGuid)) | ||
Console.WriteLine("Converted {0} to a Guid", stringGuid); | ||
if (Guid.TryParse(stringGuid, out var newGuid)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is incorrect. var is used when declaring variables. However, I still didn't test this in an IDE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did test this on https://try.dot.net/. Check this: https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-7#out-variables
I'd use discards since that variable is not used but try.net didn't like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also seeing some occurrences of var
which would compile and be correct C# code, but doesn't follow the guidelines, which says to use var
when the type is clear from the right hand side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mairaw, Thanks, didn't know this feature of C# 7.
I'll open another PR for the other occurrences of var
that doesn't follow the guidelines like:
var g = Guid.NewGuid();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var g = Guid.NewGuid();
To me, that example is clear. I would be be very surprised if a method Guid.NewGuid()
returned anything other than a Guid
. When I reviewed the changes in this PR, I didn't find uses of var
that were unclear. I don't think another PR is needed here.
docs PR dotnet/dotnet-api-docs#3393