Skip to content

Revised example#100

Merged
rpetrusha merged 2 commits intodotnet:masterfrom
rpetrusha:icomparer
Jun 5, 2018
Merged

Revised example#100
rpetrusha merged 2 commits intodotnet:masterfrom
rpetrusha:icomparer

Conversation

@rpetrusha
Copy link

Revised example

This is a revised version of the example for the IComparer interface. It includes the following changes:

  • Uses standard naming conventions (see Naming Convention docs#5587
  • Replaces ArrayList with an Array
  • Removes unnecessary whitespace
  • Modifies comments

@rpetrusha rpetrusha added the 📁 Repo - samples Indicates PRs done in the samples repo. label Jun 4, 2018
@rpetrusha rpetrusha requested a review from BillWagner as a code owner June 4, 2018 23:04
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

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

These are really good new samples @rpetrusha

I had a couple suggestions around the output methods (both C# and VB). You can decide which you want to take, and then :shipit: when you are ready.

{
int i = 0;
foreach (var item in list )
Console.WriteLine( "\t[{0}]:\t{1}", i++, item );
Copy link
Member

Choose a reason for hiding this comment

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

I'd use an interpolated string. You could also use a field width specifier for formatting instead of the tabs.

Public Shared Sub PrintIndexAndValues(list As IEnumerable)
Dim i As Integer = 0
For Each item In list
Console.WriteLine(vbTab + "[{0}]:" + vbTab + "{1}", i, item)
Copy link
Member

Choose a reason for hiding this comment

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

I'd use string interpolation here as well (with the field with specifier.)

@rpetrusha rpetrusha merged commit e0b96f3 into dotnet:master Jun 5, 2018
@rpetrusha rpetrusha deleted the icomparer branch July 26, 2018 01:57
karelz pushed a commit to karelz/samples that referenced this pull request Aug 31, 2018
* Revised example

* Used interpolated strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📁 Repo - samples Indicates PRs done in the samples repo.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants