Patterns and solutions in c sharp