C# is a multiparadigm, managed, garbage-collected object-oriented programming language created by Microsoft in parallel with the .NET platform
0
votes
1answer
17 views
Will it be okay for an interface to take a dependency on an interface in this situation?
Background
I have an interface defined for a circular-buffer called ICircularBuffer in a separate project. This ICircularBuffer is something that we use all over the place, so it resides in the ...
1
vote
2answers
24 views
Verbose Return Types
I've recently been writing some code that deals with 3rd parties -- obviously errors will happen so I'm using Either/Maybe monads where appropriate. As this is C# I'm also using async Tasks too.
My ...
0
votes
1answer
82 views
Sharing information between two independent application
I have to share parameters/information between two independent applications: an Executable and a PDF file.
By clicking a button within the pdf I want to perform some specific task (or run code) in my ...
0
votes
0answers
67 views
Should I design my Unit-Of-Work like this?
I am using .net and Entity-Framework (EF) on the back end and I would like some advice on this Unit-Of-Work (UoW) implementation.
Should I create a unit of work with one entity and multiple services? ...
2
votes
2answers
93 views
How to do dynamic dimension for loops
I have a for loop in C# as below,
int[] dim1, dim2, dim3;
//Initialize dim1, dim2 and dim3
for(int i = 0; i < dim1.Length; i++)
{
DoSomething1(i);
for(int j = 0; j < dim2.Length; ...
3
votes
2answers
108 views
Creating instances of an interface through a static method
Is the following design flawed?
Basically I have a main class used to create an object of a type and then return it as the main interface of the type. The problem with this is that each of the ...
3
votes
0answers
63 views
Generic request processing
I got a webservice that accepts multiple calls that require different handling and validation, using generics I've managed to create a common class that accepts a handler and a validator and it looks ...
-6
votes
0answers
47 views
-4
votes
1answer
128 views
Any languages where string default value = “”?
Are there any programming languages where the default value of a string is "" ? If so, what are they?
-1
votes
0answers
28 views
im using c# in unity and im getting a compiler error [on hold]
I'm new to game development and I was copying some scripts from this set of videos on YouTube. I was on the 2nd video at about 4:30 in the video. When I tried to go to play mode, it told me to fix ...
0
votes
2answers
79 views
Injecting a factory with multiple constructor parameters
Initially I needed only one queue to be created by the MessageQueueFactory:
container.RegisterSingleton<IMessageQueueFactory>(() => {
var uploadedWaybillsQueuePath = ConfigurationManager
...
-1
votes
0answers
37 views
Linear Regression Model in C# [on hold]
I have been looking for a multiple linear regression model library in C#. The best I have found is Accord which is really great but I need a model which only generates positive coefficients. The ...
1
vote
1answer
62 views
Matching objects of different types without violating SOLID/minimizing dependencies
I have two separate inheritance hierarchies that represent objects that can be "matched" to each other to consitute a FooBarMatch (which contains references to the matched FooBase and Bar partners):
...
0
votes
0answers
43 views
Candidates Criteria for a ranking system for job interview management system [on hold]
Im developing an app for my final project for my course and I thought in developing an application that managed all the interview scheduling aspects and to further help analyze the best candidates for ...
1
vote
2answers
136 views
API Design: Should I use strings or an enum for dictionary keys
I am working on an API in C#. I am trying to think about the simplest way to expose my API for consumers of it. In particular, I have a class in my exposed data model that has a dictionary property. ...
-1
votes
1answer
116 views
What should I consider when scraping content from 6k+ Websites?
I am working on a project that will scrape data from roughly about 6,000 websites. I am considering using a server/client model in which the server is responsible for scraping the data and importing ...
1
vote
0answers
24 views
XElement.Parse and querying versus serialization (strongly typed objects)
We have a rather large code base that interacts with many SOAP based XML services.
Each one of these services makes 1 to n service calls A typical low level web service call looks like this ...
-1
votes
0answers
63 views
Where is the implementation for Win32Native.WriteFile()?
I'm trying to go down the levels and see how Console.WriteLine() works.
I've narrowed it down to this:
Win32Native.WriteFile()
Which you can find here:
...
1
vote
2answers
211 views
What does Console.WriteLine() call behind the scenes?
I'm interested in how calling Console.WriteLine() actually displays text.
I've had a look at the source code from:
...
-3
votes
0answers
26 views
Parameter with Multidimensional array & params keyword
By using params keyword with 1D array in method declearation, we can pass variable number of arguments without populating arrays.
Why it is compile time error when we use params keyword with ...
0
votes
0answers
52 views
Two classes which are supposed to be the same, but differ in lists
I am using a 3rd party API which yields JSON which has two ways of loading data - as a list of items, or as a singular item. The problem is that a given item in the list has different properties than ...
4
votes
7answers
455 views
Should I use static classes for methods that will do common tasks and would be called through out my application?
I have spent the last few hours reading up on the use of static classes and trying to figure out if I should be using them or not but still have not come to any sort of conclusion. It seems that the ...
0
votes
1answer
40 views
How to have server call a web page for data on a timer
My question is not how to call a web page in code but rather what the correct architecture for it would be.
I have an MVC web app that displays certain data from our database when the user visits a ...
4
votes
1answer
48 views
Creating a service to to run logic / queries and update a table vs. running logic / queries on client refreshes
I'm not sure if this is a thing. I'm sorry about the ambiguous title--I wasn't really sure how to explain it. Basically I have a ASP.NET web page that runs two SQL queries and does some logic to ...
0
votes
1answer
50 views
Dependency injection multiple instances or only one InrequestScope
I'm trying to understand what happens with dependencies (Ninject) when a same Interface in injected in multiple classes. I am specifying InRequestScope for my bindings so as I understand there should ...
-2
votes
0answers
13 views
HTML agile package c# [closed]
I need to create a console application in Visual Basic With C# language but it requires HAP. The purpose of this console app is to download files from a website automatically
Thanks
0
votes
0answers
47 views
Serializing .NET object into a JSON string produces unreadable output [migrated]
I'm trying to convert a .NET object into a JSON string, because I want to be able to read the content of this object in the client side.
Here is my controller code:
public ActionResult ...
10
votes
4answers
483 views
Dependency Inversion expands the API, results in unnecessary tests
This question has bothered me for a few days, and it feels like several practices contradict each other.
Example
Iteration 1
public class FooDao : IFooDao
{
private IFooConnection ...
8
votes
2answers
683 views
Why aren't all method virtual or why doesn't have each class at least one interface?
This is more philosophical question, which address .NET platform, but maybe it is useful also for other languages. I'm doing lot of Unit Testing and especially when I'm using third-party components I ...
1
vote
1answer
127 views
Got confused while designing Aggregates
I am designing an application, which will store sports statistics, show them in different diagrams and do few more operations on them. Allow user to do some mock drafts etc.
I choose to build a ...
2
votes
2answers
188 views
Design pattern for managing three different objects
I´m looking for the best way to solve following problem:
I have three lists of different objects: AppleJuice, OrangeJuice & Juice. All Juice properties exists in AppleJuice & OrangeJuice ...
-2
votes
0answers
78 views
How to add and use a database in a C# project in Visual Studio 2015? [migrated]
I'm learning C# for about 7 months now, and currently I'm studying LINQ. I worked with local collections, but I'd like to use it with databases too, and learn how to use a database in a program.
The ...
2
votes
2answers
120 views
Standard way to call virtual method
So recently I was working on a project where I had a base class that provided some common functionality. It had several virtual (overridable in vb) functions. I noticed that some of these methods ...
10
votes
2answers
481 views
Is it bad to create classes whose sole purpose is to be converted to another class implicitly?
Imagine a situation where we're using a library that allows you to create Circle objects, where you can specify the radius and the center of the circle to define it. However, for some reason, it also ...
1
vote
1answer
58 views
Knowledge base UI pattern
In our database backed (C# WPF / Entity Framework) application, we want to build a system to enter, store, display and search arbitrary content linked to our main entity. The challenge here is to find ...
2
votes
1answer
174 views
Why and when would you use a .NET framework data type?
I've seen an increasing trend of people submitting code to SO that includes the use of .NET Framework data types.
I understand that the .NET Framework has its own data types (like Int16, Int32, ...
1
vote
1answer
88 views
Is a PropertyChanged event handler bad if it is used for updating the database?
I have a class with several fields.
public bool Active { get; set; }
public List<Group> Groups { get; set; }
public string FirstName { ...
3
votes
1answer
118 views
Create different classes for staffers and users?
I am building a program for a law firm.
When a staffer is active (i.e. still works at the firm) he has a password to login the program; When a staffer is inactive (i.e. no longer works at the firm) ...
0
votes
1answer
44 views
How to calculate new property for old records efficiently?
Let's say we have classes something like this:
public class Item1{
public Guid Id {get; set;}
public string Name {get; set;}
public decimal Price {get; set;}
public int Quantity {get; ...
3
votes
5answers
131 views
Conditionally initializing a string list
I am writing a program that needs to be able to process data from a number of different sources. The sources output data in a variety of formats. So, depending on which source is being used, I need to ...
2
votes
2answers
274 views
Onion architecture design question
I recently started working on a new project where the team was considering use onion architecture, which I was not very familiar with, so I started reading about it.
The application is a simple 3D ...
-5
votes
0answers
34 views
Make VS copy and paste code using some kind of attribute [migrated]
I am using VS 2015 and C#
I tried to search for it but I don't know what terms to use...
What I want to do is to mark part of my code with compiler special attribute or something and then go to ...
5
votes
1answer
227 views
Why does this shared buffer work?
Background
The following code snippet is taken from a problem in, Visual C# 2005: How to Program, by Paul and Harvey Deitel (pp. 735). The code snippet is more or less an application for accessing ...
0
votes
0answers
34 views
Suggestions for dataloading - semi dynamic data
I have a very old Perl based system that is used for CAD drawing searches, where each drawing has many metadata fields associated with it. Currently, the 'old' system has a database schema that has ...
2
votes
0answers
184 views
Dictionary of dictionaries design in C#
My question: is there a canonical way of creating a dictionary of dictionaries and providing an outer/inner key pair? Is there a NugetPackage out there with an implementation?
In my code, I have now ...
0
votes
0answers
11 views
Default Application Compatibilty Manifest for new Visual-Studio projects? [migrated]
I'm currently fighting with some app compat settings, specifically a certain shim, and looking into the compatibilty section of the application manifest.
Details aside, one thing that strikes me as ...
11
votes
5answers
350 views
Is indiscriminately catching exceptions (Pokemon exception handling) ever acceptable? [duplicate]
Normally, I don't anticipate exceptions and if I get them, its something that I can't fix in my code - bad user input or connectivity issues with the database.
But errors do occur so at the very ...
5
votes
4answers
202 views
Does anyone have a good DI registration pattern?
I've done this so many times but I never end up liking how my code turns out. I'm asking if anyone else has the same problems and can offer solutions or conventions that they've used to make cleaner ...
-4
votes
2answers
95 views
Referencing a C++ DLL from within a C# ASP.NET project using Visual Studio Community 2015 [closed]
This question might be a little odd, but is there any specific way to import a C++ reference into an ASP.NET C# project?
The problem I am having is that VS is giving me the following error:
...
-3
votes
2answers
174 views
OOP project design
here is the UML class diagram
subscribe method is used to add a herbivore object to the plant's watchers. when a plant is told to notify, itloops through all of the herbivore object in its watchers ...