Tagged Questions
1
vote
1answer
109 views
Code review for an abstract repository implementation
I have a repository abstract class that encapsulates pretty much all of the CRUD functionality:
public abstract class DataRepository<T> : IRepository<T>
where T : class
{
public ...
4
votes
1answer
146 views
How do I make this code unit-testable?
I have a functionality that imports data into a database, based on an Excel workbook and some meta data (both user-supplied). The functionality implements interface IFunctionality which essentially ...
2
votes
1answer
83 views
A complex string splitter- How do I make this working code better?
I have the below program
class Program
{
static void Main(string[] args)
{
List<Assembly> failedAssemblies = LoadAssembly();
string batchFile = ...
1
vote
2answers
135 views
How can I refactor this code in order to not repeat code?
I have this code:
private eFileStatus CheckConfigSettings()
{
mFileStatus = mXMLHelper.CheckElement(eElementName.StartLanguage.ToString(), out mContent);
if (eFileStatus.OK != ...
1
vote
0answers
40 views
Hardware resource Open/Close methods
So I'm making a program that is a serial port wedge. In other words I want it to listen to a serial port. If data comes in, wait a given amount of time, then play a sound and finally send the data ...
0
votes
2answers
130 views
Constructor with too many arguments [closed]
We have a Transaction class that's very loaded; so loaded that I originally ended up passing almost 20 argument to the ctor. After extracting a few value objects, there are still 12 arguments left, ...
0
votes
1answer
112 views
Illustrating DI and IoC concepts
This question is a follow-up to the questions here: Illustrating DI and IoC concepts : Simple code requesting review
I have taken the very good review comments got and tweaked the code. These are the ...
2
votes
2answers
150 views
Illustrating DI and IoC concepts : Simple code requesting review
I have written a little bit of code which illustrates DI(dependency injection) and IoC(Inversion of control) container. The point of this exercise is to illustrate the two methods by which you can ...
4
votes
2answers
383 views
Trying to clearly seperate my logic in my program
My problem is I need to know
is my code in my CRUD functions structured well and effectively? I plan to implement CRUD for Locations entity too. hopefully without redundant code.
you see how one ...
-1
votes
1answer
130 views
advices to clean up C# Code [closed]
I have this code but I think it is so messy and can me cleaned up a bit... But I can't because I don't know so much about C#...
The problem is that I have an if(servicio.Value == "PAS") because the ...
1
vote
1answer
226 views
Am I using too many functions in my DataAccess Class?
I am wondering if in particular the function called AssignDBStatusMessage and TryDataBaseAction are unnecessary. It seems to me that the logic is more cluttered if i do away with those functions. ...
4
votes
2answers
213 views
Progressive tax program in C#
Please review this code. It should calculate the tax precentage a person will pay in a progressive tax system. The goal is a perfect program.
Comments please.
using System;
using ...
4
votes
2answers
144 views
How do I simplify the code in C#?
Here is a code I want to simplify:
public void Method1(Context context, EventLog log = null)
{
Class myClass = ConvertToMyClass();
ApiCall1 apiCall = new ApiCall1(context);
if (log != ...
5
votes
1answer
239 views
How to simplify this c# code?
i have below function in my application i need to simplify it to improve the code quality all the suggestions are warmly welcome
void FilterValues()
{
...
3
votes
5answers
306 views
How to avoid passing variable to a method again and again
Following is a chunk of code from my class which generate PDF document. I am refactoring my code and in the process I have created short methods. But I have to pass 'table i.e PdfPTable' to my methods ...