Jeroen Vannevel
  • Member for 9 years
  • Last seen more than a week ago
Try/catch in a Tic-Tac-Toe game
Accepted answer
6 votes

Alright, first some styling remarks. Indent correctly Opening braces of your method should be at the same level below of the method signature, not indented. You seem to have done it correctly ...

View answer
Alarm clock with "ringing" functionality
6 votes

Calendar You created an alarmclock, which is really just a time-representation. A Calendar has both a date and time component. I strongly, strongly suggest you use that so you can let your user ...

View answer
Follow-Up Post Tictactoe now with AI
Accepted answer
6 votes

Fields I see a property Cells but it is never used either in Grid or any other class (as far as I can tell). Order your class members like this: Constants Fields Properties Methods This makes it ...

View answer
Lazy man's IEnumerable extension verification method
Accepted answer
6 votes

It looks handy, but I have some thoughts on it. Firstly: when you create your own IEnumerable<T> and don't implement ICollection, you'll get a logical error. It will try to convert it with as, ...

View answer
Word duplicate finder and counter
6 votes

Spaces I see many code segments like this: splitleng>0 string_to_test=1 string_to_test=sc.nextInt() Put spaces between your two expressions to result in this: splitleng > 0 string_to_test = 1 ...

View answer
Displaying information about an order when selection changes
Accepted answer
5 votes

Architecture One thing that jumps forward is that you're going straight from the UI to your datasource. In a three-layer design (UI, Model, Persistence) or MVC (Model, View, Controller) there is ...

View answer
Simplifying asynchronous "executeAsync" method along with "onFailure" callback
5 votes

If I'm having the logic correctly, I believe you can move from this: if (remoteFlag && secondaryFlag) { hostnames.add(localPrimaryHostname); hostnames.add(localSecondaryHostname); ...

View answer
Displaying a wait cursor while we're waiting
5 votes

Your intuition was correct, you're not doing asynchronicity the right way. Take a look at this bit of code: var getItems = new Task<IOrderedEnumerable<ToDoItem>>(() => GetItems()); ...

View answer
Query results with many to many and some parameters using Entity Framework in a more efficiënt way
Accepted answer
5 votes

private ICollection<Product> products = new List<Product>(); public virtual ICollection<Product> Products { get { return products; } set { products = value; } } You don't have to ...

View answer
Adapting C# 2.0 event code for C# 5.0
Accepted answer
5 votes

There are indeed some things lacking to call this C#5 code: your delegates are not necessary. The first two are easy: remove the delegate, make the event return EventHandler instead, call the event ...

View answer
Username and password creator
Accepted answer
5 votes

Magus has already cleared the naming aspects so I won't talk about them. Except for this: drop everything and review your naming. Both conventions on how you structure them and actually thinking about ...

View answer
Splitting a path string
5 votes

I took the liberty to make the exercise as well to see how our approaches differ. I don't think there are many remarks in terms of performance although StringBuilder.Remove() is a red flag in that ...

View answer
Unusual comparison of object and string
Accepted answer
5 votes

Your clarification made it a lot clearer what you want. I think you're trying too much to make it all fit on two lines and you can make it must more readable by splitting it out a little. Following ...

View answer
Generic equality checker
5 votes

I took a shot at this as well. I think @Hangy had a few good ideas but ended up with a rather complex solution. I haven't added any caching so you might want to add that yourself afterwards. What I ...

View answer
Repository implementation
Accepted answer
5 votes

Testability Your repository implements an interface which will allow it to get stubbed out easily, so that's a very testable thing. However if you want to also (unit-test) your repositories ...

View answer
Unit Testing an AppInfo class
Accepted answer
5 votes

I will give a general overview of things you should change but definitely take a look at some of my answers related to unit testing I will put at the bottom. Naming I very much advise to use a ...

View answer
Beautifying Dates
Accepted answer
5 votes

What will RevisionDate(5) do? I can't tell from the code. Methods should be expressed as actions: [Action][Context]; since you are returning a string I suppose GetRevisionDateById might be more ...

View answer
3 tier architecture ado.net application
5 votes

Aside from Mat's comments there are a few minor things: Parameters are lowerCamelCase so ConnectionString becomes connectionString. In your SQL query you use studentID and in the reader you use ...

View answer
Retirement-saving calculator
5 votes

Naming conventions As you will have noticed from the coloring: you're not following naming conventions. Variables inside a method are lowerCamelCase which means this FVc becomes this fvC Naming ...

View answer
Questions & Responses: Let me tell you about you
5 votes

Most has been said already but I'll add that you can contract these statements rusrheightininches = rusrheightininches * 100; rusrheightininches = rusrheightininches - 1; to rusrheightininches *= ...

View answer
Method to separate a list of ports to scan
Accepted answer
5 votes

Comments You have too many of them. Stick to comments that clarify the intent behind code instead of documenting the syntax. When I see List<int> listOfPorts = new List<int>(); I ...

View answer
Understanding my permalink service tests
Accepted answer
4 votes

You're right, we can clean things up a little bit. First of all the method naming: I like to use a schema which tells me the unit under test, the scenario I test and the expected outcome. More ...

View answer
Array of immutable objects initialized at compile-time
Accepted answer
4 votes

I would suggest an enum: they're made to encapsulate a set of distinct values known at compile time. For example, this might be the code you have as a result: public enum CameraInformation { ...

View answer
Unit Tests for getting the first Monday of the month
Accepted answer
4 votes

public bool CheckSendNewEvent() { var now = DateTime.Now; const int SendTime = 8; var firstMonday = GetFirstMondayofMonth(now); var timeToSendOnFirstMonday = new DateTime(firstMonday....

View answer
Adding data to the DB in EF without using navigation properties
Accepted answer
4 votes

There are definitely some things to say about this. As far as I can tell you're making things harder than they should be and by changing some things you can make your code a lot more readable. I'll ...

View answer
Trees and their uses
Accepted answer
4 votes

private Dictionary<int, T> TreeItems = new Dictionary<int, T>(); private fields are lowerCamelCase or _lowerCamelCase with the latter receiving my (and most others') preference. public ...

View answer
Cancellable progress form using async/await
Accepted answer
4 votes

Clean code, easy to follow its meaning. Some minor remarks: var progressHandler = new Progress<string>(value => MessageLabel.Text = value); var progress = progressHandler as IProgress<...

View answer
Create a new Member
4 votes

As far as I can see, createStatus is only used as an out parameter in MemberShip.createUser(). You don't need to explicitly create a new instance for this so I wouldn't do it either. I prefer to leave ...

View answer
Check if any of class properties is not null/empty/was assigned
4 votes

It looks rather hacky because I have the feeling there must be someplace down the line where you can more easily determine whether or not the properties are filled in. Nevertheless: right now your ...

View answer
WebAPI controller
Accepted answer
4 votes

I see this pattern from time to time but I don't like it: GetJobBySurnameVRN or GetJobById. That's what overloads and perhaps named arguments are for: all you care about is the GetJob part, everything ...

View answer