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
1answer
147 views

Strategy for creating a websocket relay?

I own a Raspberry Pi and would like to use it as some sort of websocket relay, so that all people who visit a specific webpage would be able to communicate with each other. The key thing about this is ...
0
votes
0answers
15 views

ObservableColection and Animations in EventHandlers

Background I'm writing a Windows Store app in C# / XAML that incorporates multiple ObservableCollections. The elements in these collections subscribe to a number of Events to start a variety of ...
-6
votes
0answers
32 views

Logica de programação em c# [on hold]

Crie um programa em C para ler um inteiro de até 4 dígitos (ou seja, no intervalo [-9999, 9999]). O programa deve inverter os dígitos do número, preservando o sinal, conforme nos exemplos de execução. ...
-2
votes
2answers
74 views

which is a better practice one method that does everything or a series of different methods?

I'm working with asp.net and c# Lets say I have a bunch of drop-downs and I want to bind data from a database, is it better to make a master-bind method that loops each one and gets the parameters to ...
1
vote
3answers
82 views

Single instance of windows service querying multiple databases

My current situation is that we have four instances of a single windows service running on the server, for production, demo, QA and dev. I am looking for a solution where I just need to run single ...
17
votes
7answers
2k views

What can one do to improve readability of math-oriented code in C#, Java, and similar? [closed]

As both a C programmer and a C# programmer, one of the things I don't like about C# is how verbose math functions are. Every time you would have to use a Sin, cosine, or power function for example, ...
0
votes
1answer
36 views

WCF Project Structure & Maintainability

We are working on a medium scale WCF project configured to use per call instancing and wondering weather it's a good practice to create classes per service method to hold the business logic since each ...
-1
votes
0answers
35 views

how to use MessageBox in C# , i tried to used its button parameter [migrated]

I try to write like this : MessageBox.Show("Request is Online process!", "callback ,tips",MessageBoxButton.OKCancel) .but it said there is no MessageBoxButton exist in the context .how can i solve ...
0
votes
0answers
27 views

How to organize css, js and other content files in asp MVC application

Basically I would like to know what would be a good way to organize content and script files in MVC, especially if i am using layouts and reusing (partial) views. I started with something like this ...
14
votes
5answers
3k views

What do you do when a client requires Rich Text Editing on their website?

As we all know by now, XSS attacks are dangerous and really easy to pull off. Various frameworks make it easy to encode HTML, like ASP.NET MVC does: <%= Html.Encode("string"); %> But what ...
0
votes
1answer
103 views

Is brevity in writing code beneficial when it requires using language constructs in a strange way [duplicate]

In C#, with extension methods, you can replace this line of code: TimeSpan interval = TimeSpan.FromMinutes(4); with this one: TimeSpan interval = 4.Minutes(); Extension method being: public ...
-3
votes
0answers
23 views

Simple issue writing from array to text file after storing what I have read as array and editing one of the arrays [on hold]

Simple issue with writing back from array to text file after storing what I have read as array and editing one of the arrays. I need to write all the information back from the array into the text ...
7
votes
1answer
213 views

How to avoid chatty interfaces

Background: I am designing a server application and creating separate dll's for different subsystems. To simplify things, let's say I have two subsystems: 1) Users 2) Projects Users's public ...
2
votes
1answer
77 views

Managing types and conversions in a compiler

I am trying to determine how to manage types and conversions between types within a compiler that I am writing. The compiler is being written in C#. There are a number of different kinds of types. ...
-2
votes
0answers
41 views

c# chat app only working on local network [on hold]

I made a chat app in C# using the UDP protocol, I don't want to use TCP. But it is only working within my own network/wifi. I made this for myself and my friend, or possibly anyone else who downloads ...
-2
votes
0answers
48 views

ASP.NET the correct technology? [on hold]

We currently have a 'dashboard' application written in Python, which does/has the following things: It basically controls 'Jobs' which are XML files. It is an application that sits in the system ...
8
votes
3answers
5k views

How to encapsulate 'global' variables in C#? /best practice

In C# what is the best practice for encapsulating variables I need to use in multiple methods? Is it OK to simply declare them at the top of my class above the two methods? Also if I am using app ...
1
vote
1answer
45 views

Stateless Web Applications Defeat DBContext Somehow?

In Entity Framework, the DBContext class is said to implement the unit-of-work pattern. As I interpret this, it means that if you make a DBContext, manipulate its data, and then dispose of it, then ...
13
votes
3answers
4k views

Why is there no generic implementation of OrderedDictionary in .net?

Why did Microsoft not provide generic implementation of OrderedDictionary? There are a few custom implementations I've seen, including: ...
1
vote
2answers
708 views

Database Context and Singleton injection with IoC

All of the below relates to a ASP.NET c# app. I have a Singleton Settings MemoryCache that reads values from database on first access and caches these, then invalidates them using SQL Service Broker ...
2
votes
1answer
42 views

SOA principles, encapsulation and autonomy

We are developing multiple web services in C# using WCF, but we´re new doing it. So, for what we have read and learnt, this is our approach: We have a class library that we called CommonLibrary ...
0
votes
0answers
17 views

Using Streamwriter to write to a specific place in a text file [on hold]

I am trying to write to a specific position in a file. In the previous windows form I have selected a person to play with. In the file you will have three lines then a blank line then new player etc. ...
11
votes
3answers
456 views

What is the best way to structure and name files which contain generic classes with the same name?

In my current project I have come across the requirement to create generic classes with the same name, but different numbers of generic parameters. For example: MyClass<T1> MyClass<T1, ...
-3
votes
0answers
45 views

Dynamic report/data manipulation with pre-selected tables & columns using EF [closed]

Please consider this is my company's requirement. Our team is in the final stage of developing the company's enterprise web application as an Asp.Net MVC + EF5 Web application. They assigned me to ...
16
votes
11answers
2k views

Should I break contract early? [closed]

About 7 months ago I made the switch from a 5 year permie role (as a support developer in C#) to a contract role. I did this because I was stagnating in my old role. The extra cash contracting is ...
-2
votes
0answers
26 views

Plotting SQL Data on the web [closed]

I am working on a project where I need to plot data from an SQL server onto the web. I am a complete beginner when it comes to this, and was wondering if I could get some help or general advice. I ...
0
votes
3answers
360 views

Manage ClickOnce releases for different parties

I'm struggling with release management of a piece of software. First some general information: It is a ClickOnce application I follow the release often practice There are about 30 parties served ...
11
votes
10answers
3k views

Converting Fortran 77 code to C#

I'm trying to convert a Fortan77 program to C#. I have a subroutine with about 650 lines of code and horrific GOTO statements all over the place. I'm having a lot of trouble even starting to visualise ...
1
vote
2answers
594 views

Data transfer between “main” site and secured virtual subsite

I am currently working on a C# ASP.Net 3.5 website I wrote some years ago which consists of a "main" public site, and a sub-site which is our customer management application, using forms-based ...
-3
votes
0answers
27 views

Suggestions for Subscription-Based Software Product Licensing [closed]

Can anyone suggest some solutions or products for doing subscription-based software product licensing? We have used dongle-based solutions in the past but, with the proliferation of virtualization, ...
3
votes
1answer
95 views

Algorithm to assign edges to smallest possible polygons?

I'm designing a procedural city generator, and the first step of the generation process is the creation of city streets. These streets extend out in a straight line to a point, then they can either ...
52
votes
11answers
6k views

Did the developers of Java consciously abandon RAII?

As a long-time C# programmer, I have recently come to learn more about the advantages of Resource Acquisition Is Initialization (RAII). In particular, I have discovered that the C# idiom: using (var ...
0
votes
2answers
977 views

Is checking count/size/length less than 0 necessary in modern languages?

Is checking count/size/length less than 0 necessary in modern languages anymore? For instance, in C# I quote often will check if a collection's count is less than or equal to 0. I assume that this ...
-1
votes
1answer
93 views

Architecture for Complex Financial Application [closed]

I want to know/understand what is the best architecture for designing/developing a complex financial application in Dot Net. This Application has features like : 1. Metric calculation (Formula ...
-6
votes
0answers
39 views

we set private access modifier but also we access tha class property why this happen? [closed]

public class Album { public int Id { get; set; } public string Name { get; set; } public int Year { get; set; } public string Genre { get; set; } public ...
0
votes
1answer
121 views

What is the correct way to bind few classes with similar functionality?

I want to do this in the right way to learn I have a few classes which have only one method. For example: public class RedColorText { public void AddRedColorText(string text) { ...
0
votes
3answers
215 views

Using SQL queries in loops

Is it a bad idea? I need to compare each entry.Key value in a Dictionary of strings to a SQL table. If there is a match, then I pull the data from that row. I was originally going to use a foreach ...
0
votes
1answer
203 views

Organizing Business and Presentation entities

Background I am developing a WPF project. This is the basic structure: User Interface (WPF Project); Interfaces (class library, contains all the interfaces and the entities used by the ...
13
votes
7answers
2k views

Is there a pattern for a more “natural” way of adding items to collections? [on hold]

I think the most common way of adding something to a collection is to use some kind of Add method that a collection provides: class Item {} var items = new List<Item>(); items.Add(new ...
0
votes
2answers
152 views

Check all “lines” in an array?

I have a 3D array with booleans and I need to check if there are "lines" that all contain true or false. With lines I mean horizontally, vertically and diagonally within the array. However I only need ...
9
votes
1answer
4k views

Understanding Visitor Pattern

I have a hierarchy of classes that represents GUI controls. Something like this: Control->ContainerControl->Form I have to implement a series of algoritms that work with objects doing various ...
-3
votes
3answers
164 views

What exactly are benefits of Method Overriding in C#? [closed]

What is the advantage of method overriding since we can always create entirely new method with different name? The only advantage of overriding is you get flexibility to use the same name of method?
2
votes
2answers
180 views

Database performance comparison

I have been tasked with moving from a MSSQL backed database, entity framework code-first, wcf service based MVC application to a MySQL backed database. I have had being trying to find a performance ...
4
votes
3answers
337 views

Method waits for user action

I have a structural problem for an application I'm working on. In the interest of full disclosure, it is for a university assignment so I'm not looking for you to code me an answer, just help me ...
3
votes
3answers
474 views

Should I try it straight or should I first check if it can be done?

I have a set of items, and each item in the set must be unique. Item are composed from multiple properties and each property of each item can be changed. But after each change every item in the set ...
0
votes
1answer
60 views

How can I decouple query and context in a “query object” scenario?

I'm using a query object pattern (similar to this) to manage disparate queries while avoiding bloaded facades/repositories. A query object takes a number of constructor parameters, representing query ...
1
vote
2answers
208 views

Is there actually an advantage to using Win API calls for file access?

I remember coding file access using the Win API about 15 years ago. It was much faster than using the FileStream of my language at the time (Delphi). I spent a while today experimenting in C# under ...
1
vote
1answer
104 views

.NET WCF: Persistent connection or Open/Close as needed?

I have a .NET WCF web service currently running in production right now. I would say 95% of the time it works flawlessly and as intended. However; there are times when I am throwing an exception that ...
50
votes
4answers
8k views

Should I encourage junior developers to use explicit or implicit typing? [closed]

I am looking to solicit the community's opinion on whether or not it would be advisable to teach junior developers to code with implicit typing (using var) or should I encourage the use of explicit ...
0
votes
3answers
137 views

Using conditions again and again or just create different methods [duplicate]

I have a method, function DoThis(bool isHuman) { // Do something if(isHuman) { //call his dad } else { //its a animal - let animal resuce know } // add some blah blah code ...