C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

4
votes
1answer
38 views

Water generating waves and reflection

For the last few days I have been working on wave generation script. As there are a lot of calculations involved I was looking for possible optimizations to improve the performance of the code. This ...
2
votes
2answers
37 views

Is my Delegate defined the right way and does it need to transform to a pretty Event butterfly?

I have read so many bed time stories and ins and outs of how delegates work and why events are to be replaced with delegates (surely not all the time) and just couldn't get my head around it. I am ...
3
votes
2answers
66 views

Mapping array to class properties

I am wondering what is the best way to map array values to properties in a class. Consider the following sample array describing information for an airport: ...
0
votes
0answers
17 views

Prevent calling methods on disposed objects and calling dispose while methods are executing [on hold]

I have a situation where some code is calling methods on an object after the object is disposed or it is calling dispose while a method is being executed. This is causing issues because the dispose ...
12
votes
2answers
770 views

The Breakfast Club attendance

This code checks a string called breakfastHours similar to 1567 which translates to Monday, Friday, Saturday, Sunday. ...
16
votes
8answers
1k views

Optimize custom double.parse()

In my company's code, they use double.tryParse() which is quite good but sets too much security for our needs. As we sometimes have to parse a few billion strings, ...
1
vote
2answers
78 views
+50

Self-contained poll application

I am working on a small and self-contained poll application, not unlike Straw Poll whereby one user can submit a poll and other users can vote (but only once). I am building this little application ...
2
votes
2answers
47 views

Ordering Gallery images by custom order

I wrote some code a few weeks ago, to take a string similar to seq[]=8&seq[]=7&seq[]=5&seq[]=1&seq[]=4&seq[]=3&seq[]=6&seq[]=0&seq[]=2 and put it into a gallery, ...
2
votes
1answer
35 views

Creating keyword records in a database

This code is part of a data model used to create keyword records in a database. ...
1
vote
1answer
313 views

Adapting C# 2.0 event code for C# 5.0

I came across this excellent post on delegates and event and tried to adapt it to C# 5.0L ...
-2
votes
0answers
20 views

Populate Tree view not displaying second level and image in the tree [on hold]

i used BrightIdeasSoftware.TreeListView for display a tree view my treeview. i want my output like below screen but my code is not displaying correctly after second ...
1
vote
1answer
39 views

Get index of value in ObservableCollection

I have an ObservableCollection<MyType> ItemList, and I need to know the index of a specific MyType in the collection. ...
2
votes
2answers
91 views

Timeouts when calculating stock ratings using LINQ

I'm getting a lot of timeouts with the following code and I'm running this method around 10,000 times so I need to figure out how I can optimize this so the timeouts will stop. I am getting timeout ...
2
votes
2answers
36 views

MVVM, Navigation, and More - Part 3

This is actually a second follow-up to Correct MVVM format, but I have made different changes. This is my ViewModel.cs class for my MainPage.xaml: ...
4
votes
1answer
64 views

Basic 30 TPS server loop

I've created a console server which is supposed to update 30 times per second, I'd like you to review it and also I'm curious about the accuracy of the server's loop. ...
4
votes
1answer
77 views

MVVM, Navigation, and More

Continuation of Correct MVVM format. This is what I have done so far, and of course it works: To start with, this is my MainPage.xaml: ...
6
votes
1answer
48 views

Monitoring directories for files that are generated by an engineering program

I have a service that monitors failure and success directories for files that are generated by an engineering program. I want to check the change was in the success or failure folder, and if it was a ...
1
vote
1answer
47 views
4
votes
1answer
64 views

Correct MVVM format

I have a Windows-Runtime app (very similar to WPF), and I am using (at least I think I am!) the MVVM style. I want to make sure I am doing this the proper way, and not just a working way. This is my ...
5
votes
2answers
82 views

Find if a word with wildcard exists in dictionary [on hold]

This is a question from a phone interview I had. The question was in 2 parts: a. find("cat") -> T/F suggest a data structure to find is if a word exists in a large dictionary, how will one node ...
5
votes
2answers
127 views

Simple image capture program

This program is eventually going to be a screen recorder, but right now I just want it to capture screen images. ...
5
votes
2answers
169 views

WPF UserControl

I wrote my first WPF UserControl today, and I would like you to review it. Its purpose is to have images by default resize with the page, but expand to full size with a double-click: ...
2
votes
2answers
38 views

Import Yahoo Contacts in C#

I have the following code for importing Yahoo contacts from an address book, but it imports only the top 30 contacts, not all of the contacts. Anyways, I think another alternative (and better) way of ...
4
votes
2answers
203 views

Checking for duplicate materials

This is a follow up question of Importing different type of files into Lists. Where the original lists are acquired. In this script I am processing the obtained lists, and comparing them with each ...
3
votes
2answers
68 views

Mapping enum keys to instance values

I am working on a pathfinding program / alogrithm, and I have the following class: ...
3
votes
1answer
31 views

Handling conditional logic inside controller actions

I am looking for best practice in handling conditions inside the controller actions in ASP.NET MVC: ...
4
votes
1answer
29 views

Reacting to Boolean state in reactive ViewModels

When this ViewModel loads we kick off the IsAuthenticatedCommand: If the result of IsAuthenticatedCommand is false we set the value of ...
4
votes
2answers
63 views

Display submenus

I am displaying menus and submenus in my WinRT app, and I think I am doing it wrong. I have thought I was doing it wrong for a long time, so here it is for review. This is the section in my ...
4
votes
2answers
105 views

Importing different type of files into Lists

I am using a recursive directory scan to find all objects inside a Unity3D project. After that, I wish to move all these files to a sorted List. Is there a cleaner ...
2
votes
3answers
95 views

WinSCP IDisposable Wrapper

I have written a simple wrapper for WinSCP in C#. I have written it to simplify SFTP connections I will needing to perform. ...
2
votes
1answer
54 views

Large message population design

We are designing a small framework to create and send messages to external parties as a result of internal events. I am reasonably happy with the design, but I am wandering if it can be further ...
4
votes
4answers
549 views

Project Euler #5 - Lowest common multiple of 1 through 20

This is my code. All comments welcome. Last time run it only took 335 milliseconds: ...
0
votes
0answers
7 views

Why is the C# Task Parallel Library code slower than a normal for loop? [migrated]

I'm wondering why the parallel code isn't faster than a normal for loop with this code: ...
4
votes
1answer
74 views

MahApps login dialog in splash screen with Caliburn Micro

We are working on an application with a splash screen. After a few seconds/loading all the data, a login dialog appears inside the splash screen, asking you to enter username and password. Think of a ...
3
votes
0answers
55 views

XAML Markup Improvements

I have a Windows Store and Windows Phone app, and in this app I have many pages like this: ...
5
votes
1answer
66 views

Adding a compose key to Windows

I made a piece of software that basically adds the functionality of a compose key to Windows, after switching from one keyboard layout to another (for programming reasons), and being unable to find a ...
8
votes
2answers
64 views

Photo gallery user control

I am trying to create something that is very reusable here so that I can use it in other sites for other pages etc. This code is for a simple photo gallery, I took the code from here, but I ...
4
votes
2answers
54 views

Displaying different tutorials about OneNote

In my app, I have this code to display different tutorials about OneNote. This clears and resets certain values, and updates some variables so we know which version we are working with. The main ...
12
votes
4answers
150 views

Rolling my own Configuration with UI

The Rubberduck Saga continues as I find a need to roll my own configuration. Since the program is really a *.dll and available to several host applications, using app.config is not an option. I ...
6
votes
4answers
179 views

First time trying async

I've been trying to learn async coding recently. I've managed to get it to work and the UI thread doesn't block like it does if I don't make the code async. I realise this is a very contrived example, ...
2
votes
1answer
50 views

Simplify Unity 3D C# code

HI have a JSON response from Facebook API, which contains the App Requests of certain Facebook App via FB.API('/me/apprequests') (using Graph API 2.0, Facebook SDK ...
5
votes
3answers
115 views

Validating email addresses through temporary mail message

I was given this project and have changed a lot of code on it, now I am going over the code to make sure that I know what everything does and can maintain it efficiently, and to make sure I want my ...
2
votes
1answer
43 views

A ViewModel using ReactiveUI 6 that loads and sends data

Most of the Rx Compelling Examples™ load and store data locally which I don't find that Compelling. I spent some time coming up with how to best perform the following actions but want to make sure I ...
2
votes
1answer
43 views

Conversion Helper with support for enumerations and Nullable<T> - The Remix

I recently wrote this code as a more versatile stand-in for Convert.ChangeType. I very recently posted an earlier version, for which I received some good feedback. I've incorporated that feedback and ...
3
votes
3answers
86 views

LINQ foreach - error handling and general improvement

I'm looking for two kinds of feedback: Is there a better way of doing what I'm attempting to do? Any obvious weaknesses that could potentially cause problems? The code in question (I've broken it ...
2
votes
1answer
41 views

Checking if a directory exists in FTP without relying on exception handling?

I've written a method to check if a directory already exists on an FTP server. The only way I could see to make this work was to return a different result from the method if an exception is thrown - ...
3
votes
1answer
66 views

Improvement of delete method [closed]

I was wondering if there is a better way to code this: ...
12
votes
2answers
168 views

My recursive parser is wet behind the ears (well, it's not DRY at least)

I have an issue opened on GitHub since mid-November, to refactor & DRY up the Rubberduck Parser module (the idea is to model the code in a VBA project or code ...
2
votes
0answers
56 views

Achieving a never-ending loop of game tasks

The following is a basic implementation of a loop which is intended to launch a series of games in a loop (generic ones that can be overridden, but that have always have finite durations). The ...
3
votes
1answer
61 views

Convert binary tree to doubly linked list

The code works and I get the results I want. Please comment about complexity, a shorter way of implementing the solution, and advice for better unit tests. ...