Rufus L
  • Member for 7 years
  • Last seen more than a month ago
  • Seattle, WA, United States
Writing multiple if tags that compare two variables
5 votes

For getting numeric values from the user, I usually create a helper function, something like: static int GetBoundedIntFromUser(string prompt, int minValue, int maxValue) { if (minValue >= ...

View answer
Program that prints an ASCII pyramid
4 votes

I took your code and started condensing it, and came up with the following improvements that could be made: Change the inner loops to use the string constructor that takes a character and a count ...

View answer
Timecode class design
4 votes

Couple of quick notes: I think you have a bug here, where you are not using the places argument, but a hard-coded value instead: private static string PadTimecodeUnit(int unit, int places = 2) { ...

View answer
Simple script to find the largest number palindrome
4 votes

For getting integers (or any other data that needs to be validated) from the user, sometimes it's best to create a separate function that you can call. For example: static int GetIntFromUser(string ...

View answer
Find consecutive numbers and turn them into ranges
2 votes

I would probably make the following changes: Rename the method to something more descriptive, like GetRangeString. Make the method static. Since no other state is needed, it makes it easier on the ...

View answer
Backing up a file to prevent its corruption during processing
2 votes

I am a little concerned about the static fields used to store timestamps in your BackupHelper class. If someone was using your class in different threads, or backing up more than one at a time, ...

View answer
Handling overwriting of unique Dictionary values
Accepted answer
1 votes

As far as your question is concerned, I'm not sure either choice is best, but if you had to choose one or the other, I would let them overwrite an existing one. Consider that right now the user has ...

View answer
Implementing a singly LinkedList and IList interface
0 votes

I would make Size a read-only property, rather than a method that returns a backing field. This requires some small refactoring, but the main change is removing the int size and changing the Size() ...

View answer