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

-2
votes
0answers
13 views

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

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
24 views

c# chat app only working on local network

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
39 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 ...
5
votes
1answer
103 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
32 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
62 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
15 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. ...
1
vote
1answer
30 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
24 views

Plotting SQL Data on the web [on hold]

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
42 views

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

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
23 views

Suggestions for Subscription-Based Software Product Licensing [on hold]

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
89 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
91 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
213 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
151 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
162 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
0answers
43 views

How to connect android software to C# or VB program in server [closed]

I created a project with android media control server and C # or VB. software android should I connect with my C # or VB programs on the server. I had trouble with the code in the android software ...
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
433 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
178 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
207 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
101 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
136 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
472 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
225 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
57 views

Explicitly using Appdomains [closed]

Since Appdomain is something CLR uses for further isolation (within Process) and is faster to load/unload than a process, is it possible to employ it explicitly in application development for a high ...
0
votes
1answer
151 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
778 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
47 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
992 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
225 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
114 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
189 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
99 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
164 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
258 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
234 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
92 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 ...
0
votes
1answer
64 views

Generating URL's that fill forms on my site

I have a asp.net web forms page where admins can search by user last name and then select them and approve or deny their access to the site. When users request access, an email is sent out informing ...
1
vote
1answer
70 views

Generic delegates (C#) in Scala?

I wanted to know if there is an equivalent of the C# generic delegates in Scala. The reference website is: http://msdn.microsoft.com/en-us/library/dd233060.aspx I'm trying to make a complete ...
-1
votes
0answers
28 views

Scaling WPF GUI [migrated]

Currently I am working on my first WPF project. I have designed a little Interface using GIMP as follow When I designed the GUI in GIMP, I used percentages for the area sizes, e.g. the most darken ...
0
votes
2answers
117 views

Flexible and easy to use settings class

I am thinking about a way to create a flexible "settings class" in C#. The question is: How to provide a confortable way to provide default values to the settings. I want the programmer to access the ...
18
votes
1answer
1k views

Confusion between F# and C# [duplicate]

I am fairly new to functional programming and C#/F#. What is unclear to me is: Can you do functional programming in C# and/or in F#? Or is it something like, you write some OO code in C#, and some FP ...
18
votes
4answers
4k views

If MVC is “Separation of Concerns” then why was Razor Syntax introduced?

My question is related to MVC design pattern and Razor Syntax introduced by Microsoft. While learning MVC design pattern I was told that the idea is based upon a principle known as Separation of ...