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
3answers
52 views

How do you create immutable objects with many parameters?

I need to create an immutable object but it requires several parameters to work like: class FooRepo { public string ConnectionStringName { get; } public string SchemaName { get; } public ...
0
votes
3answers
92 views

Does IEnumerable required to use foreach in collections

I have following class that didnt implement IEnumerable but working perfectly with foreach. And also , arrays are working without implementing IEnumerable. So why it is keep saying that IEnumerable ...
-4
votes
1answer
39 views

UserInterface and code. How they communicate? Is it just an image and nothing to do with program code

Does UI interface is just an Image created by graphics tools? I need to know that when a user interface created to read an textbox in C#. When a text entered is it take values from keyboard by ...
0
votes
0answers
23 views

Custom C# Script and Security using CodeDom

I'm making a piece of rendering software and I want to make the tools it encompasses extensible. I've built a UI that lets the user write custom C# functions for blending values. The functions (and ...
4
votes
3answers
3k views

Separation of retrieving data and business objects between DAL and BLL Layers

I did some research before posting this question. Among other questions or post, one of those is provided below. I could not get a clear mind how to determine.. Business Objects within a Data Access ...
2
votes
3answers
4k views

In what situation do Entity Framework enums become useful?

I am working on a project where there will be plenty of static options being stored in the database. I looked at using Enums for this, but do not see how they could be useful. They do not create any ...
0
votes
0answers
12 views

Bi-directionally synchronize/mirror folders over the internet

I am programming on the C# stack, but I have next to none Azure experience. We have several customers who have various processing needs on data files that reside at the customers computers. We want ...
4
votes
1answer
217 views

How to move from OOP object composition to FP function composition in C#

I have been working for a few weeks on a new web project and I am realizing that all I am doing is basically calculations and transformations on data, and that most of my classes do not contain any ...
0
votes
0answers
24 views

creating a teartown in integration test by deleting the test database and load the mdf again

I had a Friday developers debate with all my smart colleagues about Tear down process in Integration testing. They are putting a debate that getting a new database mdf file is better while during ...
22
votes
9answers
2k views

Why should one want to disable compiler warnings?

This answer and the comments added to it show a way to disable several compiler warnings using #pragma directives. Why would one want to do that? Usually the warnings are there for a reason, and I've ...
0
votes
3answers
55 views

Use HttpUtility.HtmlEncode or create extension method

Should I use HttpUtility.HtmlEncode or write an extension method? Pro for using HttpUtility.HtmlEncode is that other developers can instantly see and recognise what it's doing. Pro for using an ...
1
vote
3answers
220 views

Business rules design pattern?

I'm working on an interface for implementing business rules in order to improve SOLID-ity; so I can move a lot of logic out of Web API controllers and into a business library. The Common Problem being ...
0
votes
2answers
119 views

Is an empty class in some cases correct

I know it's generally a design flaw to have an empty class, yet I'm wondering whether there are some cases where it isn't to have an empty (abstract) class to group objects. Especially when ...
-2
votes
0answers
33 views

A Role Management System in ASP.NET MVC 5 [on hold]

I want to do a Role Management System step by step with MVC empty. Please anyone can help? I have to do authentication too.
0
votes
2answers
107 views

Private fields and encapsulation

I'm reading the head first c# book and don't quite understand what this means. "Any class can see private fields in another instances of the same class"
-2
votes
2answers
201 views

Is it normal for a graduate to be overwhelmed when looking at other's code? [on hold]

I'm a recent graduate, applying for a junior programming position (.NET). I've spoken with a few companies already, some of which I met through a recruiter. I like one of them a lot, but I'm worried I ...
0
votes
6answers
407 views

Is it easier to read and maintain code using “!” characters, or implying “Not” in the method name?

I often find that "!" characters (meaning "not" in C-based languages) are easy to overlook. So I sometimes create methods that return the inverse result. For example, instead of doing this: if (!...
1
vote
1answer
152 views

Put code on client (JS) or server (C#)

In an ASP.NET app, I've got to decide whether to put a complex piece of code on either the client in JS or on the server in C#. I've considered performance (if on server, it would be a small ...
5
votes
4answers
7k views

How to organize MVVM files in solution

I'm fairly new to the MVVM concept but like a lot of the flexibility it gives me so far. However, I'm struggling to find a good way to manage my code. I have several classes that are just sitting in ...
-1
votes
0answers
79 views

Understand the basics of C#, dont know where to go next? [closed]

I have been learning c# for a couple weeks now and I understand the basics. I have made a couple basic applications such as console calculators or password checkers. I am just stuck on where to go ...
4
votes
9answers
2k views

The definition of C-based language

What is the definition of C-based language? Is C# considered to be C-based? Is Java considered to be C-based? Furthermore, what does it mean for a language to be based on another language anyway?
1
vote
2answers
217 views

Most efficient method for large switch statements

Let's say you have many paths that an application can take at a certain point based on the value of a specific input (for example a simple int). Is there a certain method that is most efficient for ...
-2
votes
1answer
125 views

Is it better to learn a new language or a high level application of a known language [closed]

Recently I got chatting with my C# .NET professor and mentioned that over my free time I was learning Rust and it's been very interesting. To this the prof suggested me to not waste my ...
0
votes
0answers
21 views

Background layer for e-mail actions

My application features an e-mail layer (IEmailHandler) that implements various protocols (via IImapHandler, IPop3Handler etc.). Now when the user logs in, we fetch all their e-mail accounts (could ...
1
vote
1answer
51 views

Send messages from multiple services/application and display them in one place

Inside system I'm developing I have several Windows Services, couple of applications running in Scheduler and COM+ application that is running my custom DLL's. Some of them are running on same PC, but ...
2
votes
3answers
105 views

Why aren't properties implicitly convertible to delegates

We all know that properties in C# get compiled to actual plain old methods. But unlike method(-group)s, they can't be given as arguments to other methods excepting a delegate like a Func<T> or ...
2
votes
1answer
107 views

What are the important considerations when switching from monolithic to microservices architecture in .NET?

We are contemplating breaking up our monolithic monsters into microservices based architecture progressively. We have 5 teams, each team containing 2-3 C# developers, at least 1 database developer, ...
0
votes
3answers
672 views

Is there a key/key lookup table type provided in .NET?

It seems like a pretty straightforward thing to add, but I just want to be sure .NET doesn't already provide one and save me from adding unnecessary code: I need a lookup table (like a Dictionary) ...
0
votes
1answer
69 views

What's the best way to popullate a new row in a database?

Is it possible to add a new row to a database using DataSet, because when I created a new dataSet and dragged the table from the database I could see that in the dataSet methods there was one called ...
2
votes
1answer
100 views

Different ways of array declarations in C#

What is the difference between the following two methods of creating an array in C#: int[] arr = new int[] { 1, 2, 3 }; Array arr = new int[] { 1, 2, 3 };
-2
votes
1answer
53 views

compare learning curve for desktop/windows(by c#) vs mobile/android(by java)?

I have some knowledge of C# (60%) and not about java and I want to choose a programming platform between desktop/windows(by c#) vs mobile/android(by java). Which one have more difficult learning curve?...
-1
votes
1answer
30 views

Language cross platform that allows different socks connection per thread

Hello i'm developing an app that needs to do many requests with different socks connections. I was doing it in C# but i'm not sure how well it will work on a linux server even with .net core . Java ...
0
votes
0answers
16 views

Abilities interacting with aspects of other abilities - how to implement efficiently

In my game I want characters to be able to cast spells which deal a certain amount of damage of a certain type to other characters in the game. I also want abilities that negate an amount of damage ...
7
votes
1answer
404 views

I need to be able to adapt my type to theirs, and theirs to mine

I have a situation where I have an external library. In short, I need to be able to adapt my type to theirs, and theirs to mine. The library has a collection like so: interface IExternalCollection { ...
1
vote
3answers
7k views

What is good practice when inheriting static classes isn't possible/allowed

I am developing a project in C# and due to a design decision it is not possible to have a static class inherit another static class. But I have, in my opinion, a case where this would make sense. I ...
2
votes
1answer
100 views

What is the correct way to test performance of methods?

I made a few classes for processing and validating data in xlsx and csv. However, I am curious in testing how fast the methods I wrote in C# for the heavy lifting are. Here's what I currently am ...
2
votes
1answer
100 views

Event subscription in finally clause

Background My program communicates with a device that is usually asynchronous, but can sometimes behave synchronously. I have an event handler that I use for receiving the data asynchronously, then I ...
1
vote
2answers
162 views

Is a an object Necessary or can I still use a DataTable

I'm currently working on a fund project and I have it set up so I get the holdings from my database and store in in to a DataTable to process. I've created a function where my Database results are ...
0
votes
0answers
12 views

JPA: Property/encapsulated objects instead of fields

I'm moving to JPA (JavaEE, Eclipselink) from a very large C# project. The classes were not using simple fields but Property objects. Example: //C# public class State : DataObject<State> //base ...
-3
votes
0answers
80 views

MVC 5 c# Save and Upload a image on my database [closed]

My Model: public partial class tablafirmas { [DatabaseGenerated(DatabaseGeneratedOption.None)] public int id { get; set; } [Column(TypeName = "image")] [...
0
votes
0answers
71 views

Can I keep my code loosely coupled with public-facing enums?

I have some enums in a concrete API/library that will be publicly used by application projects. My problem here, is that I cannot write an interface to these enums (that I know of). I should have ...
-2
votes
0answers
49 views

Dotnet Core add Arraylist to Project [closed]

I just want to lern C# and need a ArrayList. First i add the System.Collections Package. But i can't find the ArrayList Class! Is there a package for the Arraylist in NuGet? And how is the easiest ...
7
votes
3answers
3k views

Event Driven Programming: A sequence of unfortunate events

I have a very basic game loop whose primary purpose is to check for updates & changes to a list. I have contemplated using event driven programming to replace the game loop/list idea with an ...
18
votes
4answers
8k views

Is a Unique ID column needed in a many-to-many (junction) table?

Getting a few projects started with EF, but I had some questions about join tables and keys etc. Lets say I have a table of applications and a table of permissions. Applications have many permissions ...