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
14 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. ...
0
votes
1answer
34 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 ...
-2
votes
2answers
73 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
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 ...
1
vote
3answers
81 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 ...
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 ...
-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 ...
6
votes
1answer
212 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 ...
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 ...
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. ...
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. ...
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 ...
-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 ...
-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 ...
-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 ...
-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
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
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 ...
-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?
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 ...
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, ...
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 ...
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
103 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 ...
-1
votes
0answers
23 views

How to find a specific Element in a UserControl? [migrated]

I have a referenced UserControl and want to find a specific child element in C#. This is my UserControl: <UserControl .. > <Viewbox> <TextBlock>Text</Textblock> ...
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 ...
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 ...
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
0answers
38 views

Switch Configuration of Several .Net Programs for Several Sections in a Simple Way

We build a highly configurable .Net Client/Server application. (Client is C#/WPF, Server is C#/WebService) There is a single code base, but each customer has its own 'profile'. The profile ...
2
votes
1answer
226 views

How to solve this problem of duplicate code with a design pattern [duplicate]

This is what I am doing, Creating a new Pdf document using Aspose Pdf Adding few different types pages you know introduction page, table of content pages etc... Adding some further documents to it ...
0
votes
1answer
153 views

Interface or boolean?

I have a CustomObject class which has the abilities like being Clickable, KeyPressable and Movable. I created interfaces: IClickable, IKeyPressable and IMovable and make different CustomObject classes ...
14
votes
2answers
787 views

Is there some sort of systematic strategy for designing and implementing GUIs?

I am using Visual Studio to create a GUI application in C#. The Toolbox serves as a nifty component palette that allows me to easily drag and drop buttons and other elements (for clarity I'll say ...
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
2answers
49 views

Releasing updates to Windows Services and Websites from build

I've got an solution which consists of Windows Services and websites. When updating the applications currently, the following steps are undertaken Build of solution Post build tasks copy the DLLs ...
12
votes
5answers
994 views

This way I'm writing this code is testable, but is there something wrong with it I'm missing?

I have an interface called IContext. For the purposes of this it doesn't really matter what's it does except the following: T GetService<T>(); What this method does is look at the current DI ...
0
votes
4answers
228 views

Identifying user of a webapp

For a small webapp I want to be able to identify a user. The issue is, if the user cheats in some manner, I want to be able to forbid him the usage of my application. I already have done extensive ...
1
vote
1answer
115 views

Optional referenced-type paremeter

I know in C#, by default, referenced type variables are passed by reference to a method then the changes reflect on the object outside the method. I have a function which sometimes I just need its ...
1
vote
1answer
194 views

How to write unit tests for a piece of code that has a data context?

I am new to unit testing and using Microsoft's unit testing library for following piece of code. When I execute the code normally it executes fine, however when I run unit test written for this code I ...
3
votes
1answer
101 views

Unit testing a template class after refactoring

I am cleaning up my code by way of removing duplicates, and found two classes that were almost identical, out of 55 lines, only a single predicate in an if statement differed between them. Both ...
5
votes
4answers
165 views

Using struct to enforce validation of built-in type

Commonly domain objects have properties which can be represented by a built-in type but whose valid values are a subset of the values which may be represented by that type. In these cases, the value ...
6
votes
4answers
227 views

Are noncontiguous arrays performant?

In C#, when a user creates an List<byte> and adds bytes to it, there is a chance it runs out of space and needs to allocate more space. It allocates double (or some other multiplier) the size of ...
1
vote
1answer
271 views

Two way Communication between Server and Clients

Situation: We have a web application running on a server. This application needs to fetch data from some other PC(Clients), which are on a different network. On the clients' pc there are WCF hosted ...
2
votes
4answers
236 views

Two classes that behave identically yet are semantically different

I am writing a program which is a similar to Ruby's Active Record Migrations, in which that every migration has both an "Up" and "Down" in terms of creating a change to the database, "Up" meaning ...
0
votes
1answer
93 views

To what extent can impact analysis of a code change be automated?

I'm not sure how possible it even is but as a programmer I have a sense of risk involved when I'm making changes to a code base. I've never seen a tool which basically tells me, as I'm coding, how ...