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
2answers
259 views

Project based prefix for class names

My project leader uses project based prefixes for class names, lets say projects name ABC, he create User class name as ABCUser. and he says he do this becasuse if he wants to make User.aspx Users get ...
0
votes
2answers
131 views

Is there a downside to using AggressiveInlining on simple properties?

I bet I could answer that myself if I knew more about tools to analyze how C#/JIT behaves but since I don't, please bear with me asking. I have simple code like this : private SqlMetaData[] ...
1
vote
2answers
189 views

Best way of storing a small number of user credentials

I'm working on a messaging application, based on a server/client architecture. Now I am thinking about the way how to store the user credentials. It's not a huge number, just about 20 entries with ...
1
vote
2answers
206 views

Retrying a statement or call in a catch block - code smell or anti-pattern?

I'm wondering how better to perform this operation for a large amount of files. The bit I'd like some thoughts on whether this copy/paste is acceptable enough of a tradeoff. try to write a file if ...
0
votes
1answer
90 views

Full Text Indexing Strategy for MS Excel Documents

Background As part of a broader application that allows users to search thousands of MS Office documents on a private network, I need to index and make searchable Microsoft Excel files. My basic ...
0
votes
2answers
259 views

What is a typical team size for a complex half million lines-of-code C# desktop application? [closed]

Imagine the following scenario: Codebase of 600,000 lines of code (C#) All in a single desktop application All written by a single developer (myself) over 8 years (3 years worth of actual coding ...
3
votes
1answer
85 views

Pattern to use to relate multiple data sources to different user data widgets

I have an client x server intranet application the basically gets data from the server, format it and send that data to the client for display. At the server we are using ASP.NET C# running on IIS ...
4
votes
3answers
189 views

How should I unit test a bitmap modifying method?

My Sprite class has a method: private void updateWithBitmap(Bitmap b, int x, int y) This will 'lay on top' the bitmap that's passed in, the top left corner of the passed in bitmap being at the x,y ...
-1
votes
1answer
124 views

How to catch DllNotFoundException in C#? [closed]

this question in my opinion straightforward. How can I catch an DllNotFoundException in C# as it is just an attribute to some methods use like this: [DllImport("NativeLib.dll")] private static ...
40
votes
5answers
6k views

Why was C# made with “new” and “virtual+override” keywords unlike Java?

In Java there are no virtual, new, override keywords for method definition. So the working of a method is easy to understand. Cause if DerivedClass extends BaseClass and has a method with same name ...
1
vote
1answer
82 views

How to stop the WCF service (database queriying) running behind

I have a WCF service which will get an object with huge data from database in the form of collection. I have a UI which has get and cancel buttons . Get button : make service request and continue ...
2
votes
3answers
155 views

Alternatives to foreach iterators involving ref and out

I am trying to make a flexible particle system for my XNA game, and I've got these interfaces: public interface IParticle : IUpdateable { bool Alive { get; } float Percent { get; } } public ...
0
votes
1answer
83 views

Constructors, Ignore Arguments

Is it possible to have a constructor in a class, that you can ignore certain arguments/parameters? For example, I have this constructor Car(color, make, model, wheels, type, doors) Could I call ...
1
vote
1answer
99 views

Data Access Levels of Abstraction [closed]

I'd like to describe this situation from two perspectives. I have a system called Accounts. This system is made up of subsystems which handle different account-based activities. For example: ...
2
votes
3answers
321 views

invoking methods within a conditional expression

In an oft-cited (if dated) reference for C# coding standards (pdf; from Lance Hunt), the statement is made, 33. Avoid invoking methods within a conditional expression. I've not seen this ...
0
votes
1answer
217 views

static or non-static, that is the question? [duplicate]

For comparisons / evaluations of objects of the same class(and other purposes), is it better to define a static or a non-static (is this called "dynamic" by chance?) function? Sample code: class ...
3
votes
1answer
118 views

Showing a View from another View in MVP

This question is regarding MVP triads. Lets say I have two triads and first one has View1, Mode1 and Presenter1. Second triad has View2, Model2 and Presenter2. Now what I trying to do is, I just want ...
1
vote
1answer
64 views

Presenter accessing the value in text box using sender object

I have following method in my presenters which validates the user inputs on the UI. Basically to capture the value of the text property of the text box, it uses sender object which was passed in by ...
0
votes
0answers
61 views

UI Field validation in MVP pattern

I want to validate the details provided by the user before taking them into the processing. My UIs have Text boxes, Combos mainly and, there are some fields that user must provide a data, in some ...
1
vote
1answer
93 views

Reference wind directions to texture space?

I have a 2D array filled with a simple class: class Tile { boolean N,E,S,W; } I also have a tilesheet representing all possible outcomes except all false (12 + crossroad). Now i need to ...
0
votes
0answers
59 views

Using Statement lambda in exception handling

Following is a code snippet from MVP Win Forms application and this explanation would be helpful when answering the questions. My DAL doesn't handle exceptions and it will be propagated up to the ...
1
vote
1answer
74 views

Exception handling in WIn Forms application

When handling exceptions for example in a method in my presentation logic, is it ok to catch all possible exceptions in a one catch block as follows if the only purpose here is alerting the user. ...
1
vote
1answer
74 views

DAL Exception handling in a MVP application

In a MVP win forms application I'm handling exceptions as follows in DAL. Since the user messaging is not a responsibility of DAL, I want to move it in to my Presentation class. Could you show me a ...
0
votes
1answer
102 views

Simplifying data search using .NET

An example on the asp.net site has an example of using Linq to create a search feature on a Music album site using MVC. The code looks like this - public ActionResult Index(string movieGenre, string ...
1
vote
4answers
247 views

Circular dependency and object creation when attempting DDD

I have a domain where an Organization has People. Organization Entity public class Organization { private readonly List<Person> _people = new List<Person>(); public Person ...
1
vote
1answer
160 views

.NET Compiler Platform (Roslyn) , its relevance to developer community and its performance? [closed]

I'm just starting out with a Code-Quality-plugin development for my organization based on the recently released .NET Compiler Platform APIs (Roslyn APIs). I would like to know what are the most ...
-1
votes
4answers
295 views

Advice for beginner programmer [closed]

I am beginner in software development. I noticed when I try to learn one technology let's say .NET I lose my grip over other for example Java. I thought it would be better to concentrate on one ...
-3
votes
1answer
163 views

Is it recommended to use more than one language at a startup? [closed]

I work for a mobile startup where, for historical reasons, our chosen language was C#. I was recently assigned to a small project to build a tool that would be used by us internally. When I explained ...
0
votes
3answers
126 views

calling methods if previous call success [duplicate]

I my c# program I have to perform 5 steps(tasks) sequentially. basically these five should execute one after the other only the previous task performed is success. Currently I have done it in ...
1
vote
0answers
51 views

Handling permissions in a MVP application

In a windows forms payroll application employing MVP pattern (for a small scale client) I'm planing user permission handling as follows (permission based) as basically its implementation should be ...
0
votes
0answers
65 views

does class reference itself static anti pattern in prism

I have an application and my desing approach look like this: class Manager { public int State; static Manager _instance = null; public static Manager Instance { get { return ...
-2
votes
1answer
145 views

Problem in working with async and await?

I am trying to upload files to Azure Blob Storage and after successful upload adding the filename to a list for my further operation. When i am doing synchronous it works fine but when i am doing ...
0
votes
0answers
202 views

What's the best way to expose a Model object in a ViewModel?

In a WPF MVVM application, I exposed my model object into my viewModel by creating an instance of Model class (which cause dependency) into ViewModel. Instead of creating separate VM properties, I ...
1
vote
0answers
109 views

Best Practice Method for Including Images in a DataGrid using MVVM

All, I have a WPF DataGrid. This DataGrid shows files ready for compilation and should also show the progress of my compiler as it compiles the files. The format of the DataGrid is Image|File ...
3
votes
1answer
116 views

Why DbContext object shouldn't be referred in Service Layer?

I've been looking for some implementations of Service Layer and Controller interaction in blogs and in some open source projects. All of them seem to refer DbContext object in repository classes but ...
1
vote
2answers
149 views

Should a Parent with Children have a DefaultChild, or should a Child have a Default property?

Which of the following two models makes more sense? I'm leaning towards the first one because there can only be one default child. The examples are in C# but I think it can apply to other languages ...
1
vote
1answer
56 views

Creating an object that is ready to be used & unset properties - with IoC

I have a question regarding the specifics of object creation and the usage of properties. A best practice is to put all the properties into a state such that the object is useful when its created. ...
-1
votes
3answers
164 views

Condition to use polymorphism

is polymorphism only possible when there is a scenario of inheritance or is the implementation of polymorphism not dependent on inheritance. Or is polymorphism mainly usefull when there is ...
0
votes
2answers
305 views

How to design console application with good seperation of UI from Logic

Is it considered an overkill for console application to be design like MVC , MVP or N tier architecture? If not which is more common and if you can link me to simple example of it. I want to ...
0
votes
1answer
129 views

Good approach for hundreds of comsumers and big files

I have several files (nearly 1GB each) with data. Data is a string line. I need to process each of these files with several hundreds of consumers. Each of these consumers does some processing that ...
2
votes
1answer
596 views

Why are interfaces called interfaces? [closed]

From what I understand so far, an interface is a list of methods that need to be implemented by whoever wishes to use that interface. If so, would it make any difference to call it a specification ...
4
votes
2answers
258 views

Is ok to leave untranslated advanced log?

I just had a little fight with my boss over this topic (well, the boss always wins so I will do what he wants to be done) but I'd like to have the opinion of others about this: We are making a ...
0
votes
1answer
158 views

Why is String Templating Better Than String Concatenation from an Engineering Perspective?

I once read (I think it was in "Programming Pearls") that one should use templates instead of building the string through the use of concatenation. For example, consider the template below (using C# ...
4
votes
1answer
156 views

WPF properties memory management

I'm trying to build binding system similar to the one that is used in WPF and I ran into some memory leaking problems, so here comes my question - how is memory managed in WPF property system? From ...
0
votes
1answer
216 views

If a library doesn't provide all my needs, how should I proceed? [closed]

I'm developing an application involving math and physics models, and I'd like to use a Math library for things like Matrices. I'm using C#, and so I was looking for some libraries and found Math.NET. ...
3
votes
2answers
209 views

Data structure for grid with negative indeces

Sorry if this is an insultingly obvious concept, but it's something I haven't done before and I've been unable to find any material discussing the best way to approach it. I'm wondering what's the ...
2
votes
1answer
197 views

Best practice to collect information from child objects

I'm regularly facing following pattern: public abstract class BaseItem { BaseItem[] children; // ... public void DoSomethingWithStuff() { StuffCollection collection = new ...
0
votes
2answers
245 views

Can an object call a method on it's immediate descendant? [closed]

I have an inheritance hierarchy three deep : an abstract base class, from which I derive another abstract class, call it the intermediate class, from which will derive possibly a large variety of ...
3
votes
4answers
1k views

Is this method pure?

I have the following extension method: public static IEnumerable<T> Apply<T>( [NotNull] this IEnumerable<T> source, [NotNull] Action<T> action) ...
-3
votes
1answer
82 views

Wrong encoding in DataReceivedEventArgs [closed]

I start cmd.exe process and redirect stdin to pass script to it and redirect stdout and stderr to read cmd's output. Here is the code of my DataReceivedEventHandler: (o, a) => { ...