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

learn more… | top users | synonyms

0
votes
0answers
35 views

Login from external application in MVC

We have an ASP.Net MVC application that use Identity provider to authenticate users. A new customer now wants to access owr application pressing a button inside their winform app. I started to modify ...
0
votes
0answers
40 views

Architecture Decoupling

I have set up my ASP.NET MVC project as follows: Presentation Layer : ViewModels, Views, Certain logic to handle service responses Business Logic / Service Layer : Services that work with data from ...
2
votes
1answer
132 views

Is there a design pattern for splitting up files into smaller files?

I am developing a project where I have to load very large files (upto 50 MB). Currently I am loading these files completely into (consecutive) memory. This has the advantage that I can very easily ...
-2
votes
0answers
29 views

Efficiently retrieving and filtering files by using filename [on hold]

trying to filter files with formats such as pdf file names the following structure: Items number + Revision + lot number 1109093-A2 (85806S) pdf 1109093-A3 (85806S) pdf 1109092-A1 (85806S) pdf ...
-1
votes
0answers
35 views

What is exaclty Timer Deamon in windows? how can i get that using C#?

I have been trying to find the difference between the RTC clock and the system clock. At last I found that Timer Deamon in windows try to compare time between RTC and OS clock. If it is more than 1 ...
0
votes
2answers
45 views

Possible design patterns for base function with possible additions

I have various interfaces i have to implement. Let's assume ITypeA, ITypeB. They have following methods: ITypeA Connect Disconnect GetData SetData ClearData ITypeB Connect Disconnect ...
-2
votes
0answers
15 views

C# reports From data path [on hold]

I would like to get this clear how can i load reports from a path file and add them in a list box and from there when the list box selected Item is double click the report will generate. please help!
-1
votes
0answers
55 views

Push Notification from Server ASP.NET with SignalR v1.2 [on hold]

I was developing an ASP.NET website which would require real time notification based on events from Server. Basically there are two Classes of Users. Back Office Front Office In the event that a ...
-4
votes
0answers
25 views

How to store, list, open files to MySQL using C# [on hold]

Im creating a c# employee app, I've created a form for Employee files and I dont have any idea how to store list and open files to mysql with c#. Any help with detailed example will be aprociated! ...
3
votes
1answer
131 views

Redundancy caused by polymorphism

I have two chat rooms, one has administration behaviour, and one doesn't. I have factored out all of the common code into a base chat room, but the AdministerChatroom behaviour I have pulled out into ...
0
votes
0answers
4 views

Displaying Fibonacci sequence [migrated]

wrote a program to calculate and display the first 20 fibonacci numbers, the sequence goes as follows: 1, 1, 2, 3, 5, 8, 13... (each number is the sum of the previous two numbers) The problem is ...
-1
votes
1answer
69 views

Pros and cons of using generic delegates as nested functions

I've written code like this before: private void Strings_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { var onAdd = new Action(() => { if(e.NewItems != ...
-3
votes
1answer
40 views

How create unit test the performance of an application? [on hold]

What I want is to run automatically methods to tests the performance of an application. Just like the unit tests, but with the purpose of evaluate the performance and create reports if is it possible. ...
1
vote
2answers
109 views

Implementing a generic/dynamic custom property system in C#

I have an architecture design problem which I think is appropriate for this site. General problem description: My primary goal is to design a software library/program (C#) to automate a very ...
3
votes
1answer
68 views

Wpf: Event driven vs MVVM design pattern

I'm a beginning coder and I've been working on a WPF app for several months now and struggled to implement anything in MVVM due to time constraits to learn so I coded my program the only way to knew ...
0
votes
3answers
71 views

BackgroundWorker starting again in Completed event

I want a background worker to continue running and occasionally update the user interface. My first idea was to use a BackgroundWorker and in its completed event just fire it up again. Is using a ...
0
votes
1answer
81 views

How to verify that library assemblies originate from a given Web site?

How would the following solution be implemented? Would you need to put this code in each library assembly or just in the main assembly that is determining whether it is safe to call the library ...
-3
votes
1answer
174 views

As a new programmer, how do I setup my environment to learn C#? [closed]

I have a little (Grade 12 High School Level) experience with SQL and Java, so my understanding of programming concepts is basic. I want to learn to code in C# using the .NET framework. I have looked ...
2
votes
2answers
166 views

Having an inherited function return the derived type instead of the base type

I am writing two classes in C#: A Matrix class that represents a general Matrix with n-by-m dimensions A SquareMatrix class that inherits from Matrix and has the constraint of being n-by-n The ...
7
votes
3answers
321 views

What optimizations can be done for soft real-time code in C#?

I'm writing a soft real-time application in C#. Certain tasks, like responding to hardware requests coming in from a network, needs to be finished within a certain amount of milliseconds; however it ...
4
votes
1answer
80 views

Is it better to put an event on the top object or closer to where it's local?

Take the following basic structured code for example: class Player { public QuestLog QuestLog { get; set; } } Let us consider that "QuestLog" has the ability to fire off some events when things ...
0
votes
2answers
161 views

C# - initialize variable inside method and use in whole class [closed]

this is a conceptual question, but if i initialize a variable in c# as public will it be able to be used in the class as I want a variable "player1" and a variable "player2" where either could be one ...
1
vote
0answers
100 views

How do I resolve $ref in a JSON object?

I have written a single page application that uses rest services to retrieve JSON objects. The JSON objects being returned are C# objects serialized using the Newtonsoft.JSON library. The returned ...
0
votes
1answer
71 views

Synchronized access to network industrial equipment

I have an industrial equipment which is controlled by a software. The software connects to it using sockets, and keeps the connection all the time alive, while from time to time sending commands to ...
-1
votes
1answer
261 views

Are there any scenarios where the 'Dispose Pattern' shouldn't be used on an Object which contains managed and un-managed resources?

MSDN says that to properly clean up an object which contains managed and un-managed resources, you need to implement the 'Dispose Pattern'. Given that the class implements the IDisposable interface, ...
5
votes
3answers
403 views

Overloading methods that do logically different things, does this break any major principles?

This is something that's been bugging me for a bit now. In some cases you see code that is a series of overloads, but when you look at the actual implementation you realize they do logically different ...
-1
votes
0answers
80 views

Credit Card Payment Processing which APIs do you use? [closed]

It's for a Point of Sale Terminal where the customer will bring the physical credit card and it will be swiped through the terminal. The business has a merchant account on some banks. So, how do I ...
7
votes
6answers
514 views

Algorithm to generate N random numbers between A and B which sum up to X

This problem seemed like something which should be solvable with but a few lines of code. Unfortunately, once I actually started to write the thing, I've realized it's not as simple as it sounds. ...
21
votes
12answers
5k views

Why does void in C mean not void?

In strongly-typed languages like Java and C#, void (or Void) as a return type for a method seem to mean: This method doesn't return anything. Nothing. No return. You will not receive anything from ...
7
votes
4answers
436 views

Alternatives to multiple inheritance for my architecture (NPCs in a Realtime Strategy game)?

Coding isn't that hard actually. The hard part is to write code that makes sense, is readable and understandable. So I want to get a better developer and create some solid architecture. So I want to ...
1
vote
3answers
141 views

Am I violating LSP if the condition can be checked?

This base class for some shapes I have in my game looks like this. Some of the shapes can be resized, some of them can not. private Shape shape; public virtual void SetSizeOfShape(int ...
2
votes
2answers
149 views

Dependency Injection: where to store dependencies used by only one method?

I am developing a project integrated with Dependency Injection (just for reference, I'm using Unity). The problem is that I have some Manager classes with several methods and in many cases I have ...
2
votes
0answers
44 views

In WPF, should I base my converters on types or use-cases?

I'm looking for some advice on how to write my WPF value converters. The way I'm currently writing them, they are very specific, like (bool?,bool) => Brush, i.e. I'm writing each converter for a ...
0
votes
1answer
74 views

How to make the members of my Data Access Layer object aware of their siblings

My team currently has a project with a data access object composed like so: public abstract class DataProvider { public CustomerRepository CustomerRepo { get; private set; } public ...
1
vote
1answer
73 views

Performing a Depth First Search iteratively using async/parallel processing?

Here is a method that does a DFS search and returns a list of all items given a top level item id. How could I modify this to take advantage of parallel processing? Currently, the call to get the sub ...
1
vote
2answers
239 views

C# inherit from a class in a different DLL

I need to make an application that needs to be highly modular and that can easily be expanded with new functionality. I've thought up a design where I have a main window and a list of actions that ...
0
votes
2answers
120 views

Interface (contract), Generics (universality), and extension methods (ease of use). Is it a right design?

I'm trying to design a simple conversion framework based on these requirements: All developers should follow a predefined set of rules to convert from the source entity to the target entity Some ...
1
vote
0answers
96 views

What strategy to follow while matching sql server datatypes in C# Code First approach while using Entity Framework

While matching SQL Server datatypes with C# Code First Approach in Entity Framework, what are specific points that we should keep in mind so that our C# datatype should match exactly our SQL Server ...
2
votes
3answers
204 views

Decoupling software components via naming convention

I'm currently evaluating alternatives to refactor a drivermanagement. In my multitier architecture I have Baseclass DAL.Device //my entity Interfaces BL.IDriver //handles the dataprocessing ...
-2
votes
2answers
74 views

How to name a clamp function that only clamps from one side? [closed]

Clamp() is a function that ensures that provided variable is in provided range. You can find such function in .NET, in Unity, and probably anywhere. While it is useful, I often need to clamp my value ...
2
votes
2answers
162 views

What to Return with Async CRUD methods

While there is a similar question focused on Java, I've been in debates with utilizing Task objects. What's the best way to handle returns on CRUD methods (and similar)? Common returns we've seen ...
0
votes
0answers
10 views

String contains trailing zeroes when converted from decimal [migrated]

I've run into an unusual quirk in a program I'm writing, and I was trying to figure out if anyone knew the cause. Note that fixing the issue is easy enough. I just can't figure out why it is happening ...
1
vote
1answer
67 views

Where to store front-end data for “object calculator”

I recently have completed a language library that acts as a giant filter for food items, and flows a bit like this :Products -> Recipes -> MenuItems -> Meals and finally, upon submission, ...
1
vote
1answer
208 views

Implementation of instance testing in Java, C++, C#

For curiosity purposes as well as understanding what they entail in a program, I'm curious as to how instance testing (instanceof/is/using dynamic_cast in c++) works. I've tried to google it ...
0
votes
0answers
3 views

Console App error An object reference is required for the non-static field, method, or property [migrated]

Hey all I am trying to get the following code to work but currently I am getting this error: An object reference is required for the non-static field, method, or property ...
0
votes
1answer
171 views

How can I set a time limit for a game?

I am learning the multi-threading and timer in C# now. But it seems I can't find a good solution. For example, I would like to see how many addition problems that I can solve within 1 min. I would ...
0
votes
1answer
94 views

Can't understand on how to implement MVP/MVC for my software requirements [closed]

Recently I decided to start developing a client/service based system using WCF and a Duplex Channel (callbacks from Service to client). The clients will behave as "slaves", that is, they will only ...
1
vote
1answer
36 views

Replaceable parameter syntax meaning

Replaceable parameter syntax for the console object in C#. I am taking the O'Reilly C# Course 1 and it is asking for a replaceable parameter syntax and it is not very clear on what that means. ...
0
votes
1answer
81 views

Passing in config values to a method using SOLID principles

I have an email helper class that has a method that sends email: private static class EmailHelper { public static void SendEmail(string from, string to, string subject, string message) { ...
-2
votes
1answer
56 views

How to get a database on my filesystem that I can use in my application [closed]

I'm making a .NET application where I'll have a lot of data entries. This will not go to any server though, but needs to be stored and updated, frequently on the local machine. I would like something ...