C# is a multi-paradigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.
0
votes
0answers
15 views
Is this the best way to update entities with Entity Framework? [on hold]
Most of the time I update (lets say a user account) in the following way:
...
2
votes
1answer
23 views
Cross-Database Query Without Casting to List
I am trying to do a cross-database query without having to enumerate the variable t.
...
0
votes
0answers
17 views
MongoDB repository, dynamic objects, Razor Templates
I am writing a repository for MongoDB and are looking for some review at its current state. I am looking for ways to improve it without adding complexity.
Should I be using a Singelton pattern for ...
3
votes
0answers
37 views
Populate tree from 3 different data sources and show its content
The task is to build a WinForm app which populates a tree from 3 different data sources and shows its content.
1 ComboBox at top - to choose datasource. (File System, XMLFile, SQLDB)
1 Button next ...
4
votes
3answers
86 views
Unit tests for a simple composite
I do a lot of unit testing(tdd) and would like some comments about my style. Here is a simple example from a composite.
Is there anything I could improve?
...
5
votes
2answers
87 views
Color structure with single field for multiple properties
I'll get right to it, this struct is used a lot throughout my programme. This struct is responsible for only things regarding colour, not anything else.
I'm ...
-5
votes
0answers
38 views
-2
votes
1answer
51 views
Integration test good practice [on hold]
I have been using unit tests for some time. But, now I need to write integration tests. I should save something to DB, and then check if saved data is ok. I can't find any simple, clean examples of ...
3
votes
1answer
20 views
Container supporting PeekMax, PeekMin, Sum, and PeekNextToMax v2.0
This is another part of the update to this question. The interfaces are in this question.
To summarize, the class is a generic container similar to MaxHeap, but only needs to support the following ...
5
votes
1answer
48 views
Winforms Mathematical Operator Label
I wrote a custom class which (atm) displays the +, -, =, x, and ÷ operators inside a circle. Apart from the issue of some symbols not appearing in the exact center (everything except + looks a bit ...
2
votes
0answers
32 views
NHibernate multiple select queries
I have a service called "Roles" allowing me to retrieve all 'items' on which I have permissions. I'm experiencing a interesting performance issue with NHibernate ...
3
votes
1answer
232 views
Calculate pairs in a Set (“Sherlock and Pairs” HackerRank challenge)
I have started reading clean code and want to improve my coding practices. Here is my attempt at solving an online puzzle. Please review the code and let me know how could I have written it better in ...
4
votes
1answer
56 views
Conference Scheduler
Problem
You are planning a big programming conference and have received many
proposals which have passed the initial screen process but you're
having trouble fitting them into the time ...
1
vote
1answer
29 views
Interfaces & Factory for generic container supporting PeekMax, PeekMin, Sum, and PeekNextToMax
This is a partial update of this question.
An implementation of these interfaces is in this question.
To summarize, the class is a generic container similar to MaxHeap, but only needs to support the ...
2
votes
0answers
35 views
Implementing TAP around WMI
I'm trying to improve my skills with the Task-based Asynchronous Pattern (TAP), by writing simple task-based wrappers around some WMI methods:
...
5
votes
2answers
55 views
Regex Search/Replace
Rubberduck's latest (and greatest?) feature is a regex search/replace:
This is the defining interface:
...
2
votes
1answer
53 views
Global.asax singleton
Please help me decide whether this should be good or bad idea to declare a Singleton variable in Global.asax file. (It is not actually singleton pattern, I just want to make sure that only one ...
0
votes
2answers
55 views
Finding bonds needed to be calculated and calculates them
I am writing a program that updates bonds in an external system that I have database access to. The program is run in an 8-minute interval.
Bonds are stored in a table called ...
1
vote
1answer
41 views
Cross-cutting delete flag in a repository
I want to have a cross-cutting delete flag in my repository. I have the following repository pattern at the moment:
...
0
votes
1answer
44 views
Optimize LINQ search with custom fixed ranking
I have to perform on some collection and return ranking based on some logic
I wish to optimize this working code since I think it can be bettered (maybe using tasks?).
I need to search on ...
0
votes
0answers
33 views
Optimizing LINQ routines
I run a build system. Datawise the simplified description would be that I have Configurations and each config has 0..n Builds.
Now builds produce artifacts and some of these are stored on server. ...
4
votes
1answer
90 views
Custom encryption algorithm, “SBC”
I decided to roll out my own encryption algorithm, which I am calling "SBC" or Simple Byte Cipher. Essentially, I just take the bytes of the string data, do a Caesar cipher like shift to it, increment ...
3
votes
1answer
59 views
1
vote
1answer
58 views
DatabaseManager and connection in C#
I am posting here to get a code review on my DatabaseManager and DatabaseConnection classes, and for answers on how I can improve. I won't spend too long drolling on, but this is a database manager ...
0
votes
1answer
35 views
UserInfo information class with a database
I am no expert in C#, the opposite really, I just wanted an overall review on my UserInfo class that gets user information from a database using MySQL. I was also ...
6
votes
2answers
206 views
Finding binary combinations based on substitute wildcards
I am given a string containing the possible characters of : 0, 1, and ?, iterating over ...
2
votes
3answers
81 views
Method that returns an integer chosen by user
Can I make this:
if (oneFour == 1 || oneFour == 2 || oneFour == 3 || oneFour == 4)
shorter, especially if I'm gonna need a wider range of integers?
Do I need to ...
1
vote
1answer
27 views
Resumable HTTP download class - Follow-up
Is there a better way to calculate the download speed than what I'm currently doing now? Are there any suggestions on improving the updated code?
Pure version:
...
9
votes
1answer
69 views
IoC Registration: Convention over Configuration
The rubberduck project has reached a turning point. The core features are implemented (except the SmartIndenter embedding - we're keeping that for 2.0), the next few releases will probably just build ...
4
votes
1answer
87 views
Finding out which user has made the most progress
I have some code to accomplish the objective of finding out which user has made the most progress. Progress is measured in integer values, the higher the better. ...
4
votes
1answer
53 views
Project Euler 42 - Finding triangle numbers
Here is my solution for Project Euler Problem 42, which is described in the following:
The \$n^{th}\$ term of the sequence of triangle numbers is given by, \$t_n = ½n(n+1)\$; so the first ten ...
0
votes
0answers
22 views
Checking size of StorageFile stream before writing to it [closed]
I want to write to a StorageFile in Windows Phone 8.1 (using C# libs). I have to open a stream before I can begin writing, and I get the size of the file from the stream.
I want to see that if the ...
6
votes
4answers
324 views
Conversion of hexadecimal string to string
Given a C# string which is a set of hexadecimal numbers such as:
string HexString = "202048656c6c6f20576f726c64313233212020";
Where those hexadecimal numbers ...
1
vote
1answer
62 views
Get list of unique parents from childrens list
Parent has list of Children. I only have access to the list of children. I need to get list of unique parents from the List of ...
-1
votes
0answers
25 views
Getting, Processing and returning a update collection [closed]
Self explanatory code here, This is just an example of what I am doing, had to change names and remove irrelevant code to make it as short as possible,
...
0
votes
1answer
41 views
Delayed Include rules for EntityTypeConfiguration using LINQ expressions
The aim of this class is to set rules for including navigational properties on Configuration level and then apply where needed in the code.
I've decided to store expressions in the list for different ...
2
votes
0answers
34 views
WPF MVVM Dialog with Prism, MahApps.Metro
I am building a Metro-themed WPF application with MVVM approach using Prism and MahApps.Metro. I have to show a custom dialog from view model. Currently, I am using ...
10
votes
4answers
778 views
Method to count all comments in single external C# file
I recently had an interview question:
Write a method that counts all comments in a single external file.
It was a timed question and I wanted to know if this is the best way to accomplish the ...
3
votes
1answer
37 views
Unit-testing an RSS feed parser
I'm working on a class to parse RSS feeds using SyndicationFeed. (related to Downloading data using HttpClient). I'm trying to write this so it can be unit-tested, ...
6
votes
4answers
329 views
Resumable HTTP download class
Any suggestions, corrections and advice would be very nice and much appreciated.
...
3
votes
2answers
150 views
CRUD operation class
This code is a chunk of big project, so I am sorry in advance for not adding everything as it's just not possible.
...
6
votes
1answer
126 views
Custom ViewModel to check property existance prior to update
I have written an abstract View Model which all my other View Models inherit when I write any apps in Silverlight, WinRT, WPF etc. The class was written to attempt to address an issue I have run into ...
2
votes
1answer
55 views
Downloading data using HttpClient
I'm working on a class to download some data from an external server and feed it into my data model. I'm new to both HttpClient and ...
10
votes
6answers
3k views
5
votes
1answer
195 views
Preparing a YouTube downloader based on Windows form
The program this function was written for is a Windows forms program.
This function downloads videos from the internet one after the other. It runs in a separate thread (so the user can drag the form ...
2
votes
0answers
65 views
C# port of data mining algorithm much slower than reference implementation
I was trying to implement the algorithm specified in this research paper (please ignore the math, since it's irrelevant to the question). This algorithm is very basic in formal concept analysis. The ...
3
votes
3answers
2k views
Secure Encryption Algorithm
The algorithm gets the number associated with each char, then adds a random number to it and saves the numbers it added. I plan to make an ...
-1
votes
1answer
44 views
Repeated Code - What techniques can i employ to ensure there is no repeated code in my application?
C# - The application works fine but I would like to improve the organization of my set of codes by ensuring there is no repeated code, I am struggling to figure out what methodologies can fix this ...
3
votes
1answer
28 views
MEF Execute Plugin Exports in Threads
I am developing a service application that would implement a peer to peer messaging system. I am wondering if my following code is the best approach. It works, but I am naive and it would be nice to ...
6
votes
2answers
97 views
Finding a gameObject on a screen
I'm working on a warning system for my game. I want to display an arrow on the screen where the object is going to be coming from.
Here is an image of what I have in mind:
The object will spawn ...