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

1
vote
0answers
48 views

Need help understanding Mocks and Stubs

I'm new to use mocking frameworks and I have a few questions on the things that I am not clear on. I'm using Rhinomocks to generate mock objects in my unit tests. I understand that mocks can be ...
0
votes
0answers
10 views

ASP.NET MVC3 checkbox dropdownlist create [migrated]

i'm new in asp.net MVC and I/m use view model to poppulate the dropdown list and group of checkboxes. I use SQL Server 2012, where have many to many relationships between Students - Books; Student - ...
0
votes
0answers
69 views

How do I explain the importance of NUNIT Test cases to my Colleagues [duplicate]

I am currently working in Software Development for applications including lot of Mathematical Calculations. As a result there are lot of test cases that we need to consider. We donot have any NUNIT ...
4
votes
2answers
193 views

Hide or Show singleton?

Singleton is a common pattern implemented in both native libraries of .NET and Java. You will see it as such: C#: MyClass.Instance Java: MyClass.getInstance() The question is: when writing APIs, ...
-1
votes
0answers
36 views

A generic Re-usable C# Property Parser utility [on hold]

This is about a utility i have happened to write which can parse through the properties of a data contracts at runtime using reflection. The input required is a look like XPath string. since this is ...
0
votes
3answers
150 views

What would be the fastest way of storing or calculating legal move sets for chess pieces?

For example if a move is attempted I could just loop through a list of legal moves and compare the x,y but I have to write logic to calculate those at least every time the piece is moved. Or, I can ...
0
votes
0answers
36 views

Generic Repository with SQLite and SQL Compact Databases

I am creating a project that has a mobile app (Xamarin.Android) using a SQLite database and a WPF application (Code First Entity Framework 5) using a SQL Compact database. This project will even ...
1
vote
3answers
298 views

Dependency Injection Confusion

I think I have a decent grasp of what Dependency Inversion principle (DIP) is, my confusion is more around dependency injection. My understanding is the whole point of DI is to decouple parts of an ...
0
votes
0answers
45 views

Removing surrounding noises from voice recording [migrated]

I have a wave file whose frequency spectrum looks like this. It contains audio, which I want to keep while removing the rest. The problem is that the surround noise changes, just those distinct ...
8
votes
2answers
230 views

Why is an anemic domain model considered bad in C#/OOP, but very important in F#/FP?

In a blog post on F# for fun and profit, it says: In a functional design, it is very important to separate behavior from data. The data types are simple and "dumb". And then separately, you ...
-2
votes
0answers
17 views

How can I bind a custom color to WPF toolkit ColorPicker? [on hold]

I need to bind the SelectedColor property of ColorPicker to a custom color which is not present in available colors. I created a simple test to show my problem. My xaml: <xctk:ColorPicker ...
0
votes
1answer
83 views

Sending email notifications to users

What is the preferable way to send email notifications to users? I can do it both ways but what is better? have some c# code that calls stored procedure in the database. Stored procedure based on ...
-1
votes
1answer
70 views

use of Enum with flags in practice?

I just have read some stuff on enum today. Use of flags with enum was something interesting and new for me. But often practice and theoretical uses are different. I go through many articles they ...
-2
votes
0answers
34 views

How do i rotate a 2D picturebox according to my mouse [on hold]

I would want to rotate my picturebox which contains an image. The image will just spin around following the mouse, but the position of the image is fixed. Any idea on how it should be done? Btw using ...
2
votes
0answers
64 views

Clustering Strings on the basis of Common Substrings

I have around 10000+ strings and have to identify and group all the strings which looks similar(I base the similarity on the number of common words between any two give strings). The more number of ...
-4
votes
0answers
68 views

LINQ/LAMBDA filter query by date [on hold]

I'm trying to use LINQ to SQL to retrieve earnings data for a particular date range. Currently the table is set up as follows: Comp Eps Year Quarter IBM .5 2012 2 IBM .65 ...
2
votes
3answers
128 views

Recommened design pattern to handle multiple compression algorithms for a class hierarchy

For all you OOD experts. What would be the recommended way to model the following scenario? I have a certain class hierarchy similar to the following one: class Base { ... } class Derived1 : ...
3
votes
3answers
122 views

Design pattern for logging changes in parent/child objects saved to database

I’ve got a 2 database tables in parent/child relationship as one-many. I’ve got three classes representing the data in these two tables: Parent Class { Public int ID {get; set;} .. other ...
2
votes
1answer
67 views

How to serialize and deserialize lambda expression in F#?

I serialized lambda expressions in C# before. Now I wanna use F# instead of C# for serialization and deserialization. I heard F# is better in this area. Is it true? How can I do that with F#? I’d ...
0
votes
0answers
29 views

Refactor LINQ & XML code [migrated]

I have some duplicate code using LINQ & XML. I'm sure there is a way to refactor it, but I'm not sure how to go about doing it. Would someone help, please? var fileInfo = ...
0
votes
0answers
29 views

Process video (canon) mov files

Well i would like to program something to process HDR made by magic lantern a canon add on. That doesnt change the format its just some kind of add on, that can produce HDR video. Its a bit complex to ...
84
votes
5answers
3k views

SOLID Principles and code structure

My question is on SOLID principles, because I couldn't answer a question (beyond the obvious meaning of the various principles of SOLID) at an interview and it really bugs me. I have done a couple of ...
0
votes
1answer
22 views

Provide multiple SendCompleted callbacks to SmtpClient

I have an Email class that has a Send method that optionally takes an SmtpClient and sends an email asynchronously using SendAsync. If no SmtpClient is supplied to this method, it instantiates a ...
0
votes
0answers
58 views

How do I make a window that acts as a middleman between a client program's IO and the user's IO?

For Windows 7, in any of the tagged languages (vb.net, C#, Java) would it be possible to have a (100*ratio)x100 px^2 "middle" window that would be able to: Copy a windows's graphics data ...
1
vote
1answer
103 views

Keyboard shortcut for C# property declaration?

I've previously used a shortcut for creating C# properties in Visual Studio 2010, but I cannot remember what this was. If I was to type: public string Foo I could type a shortcut which would ...
1
vote
2answers
177 views

Is it a right thing to do, to use Node.JS as a TCP Server? [closed]

Part I - The Story: I have crafted a high performance TCP server in C# (based on SocketAsyncEventArgs) which works brilliantly (for my cause). I have more than 7000 clients, sending me a message ...
0
votes
0answers
80 views

Retrieving system information without WMI

I want to write an application where I can fetch system information like CPU-Z (for example) does. I don't want to rely on WMI, because I want to grab stuff like information about the manufacturing ...
0
votes
0answers
9 views

FilePathResult works for ActionLink but doesn't work from JavaScript [migrated]

I'm not sure why this occurring, but when I call my action from a "ActionLink" it works properly, but when I call it from javascript it doesn't. Both methods get to the "ExportFile" method, but only ...
0
votes
1answer
93 views

Refactoring classes with ref to themselves

How can I refactor this code? class Node { public Node Parent { get; set; } } class AVLNode { public AVLNode Parent { get; set; } } I tried to use inheritance, but then I have to use type ...
0
votes
0answers
71 views

Design Structure/Data Structure thoughts needed

I am reading a Binary file, it has several blocks, each block has different names/data. Some of this data is string value, date, datetime, time but most of them are integer value. Previously I code a ...
1
vote
1answer
112 views

Reducing repetitive DI code

I have a method which constructs dependencies using Unity. Currently, all of the calls do pretty much the same thing: Registers 2 repository object and 2 'App Part' objects. My issue is, there's a lot ...
0
votes
0answers
11 views

Trouble Getting C# Graphics to work in Form [migrated]

I am trying to make a C# Windows form in Visual Studio so I can draw on the form (like a basic version of Microsoft Paint). I am working through an example in a C# 2012 book. I have written the code ...
0
votes
2answers
138 views

embedding programming languages into other languages [duplicate]

In C/C++, there is a keyword that allows you to enter assembly language directly into a method. Example int Main() { __asm // notify the compiler that this block is assembly language. { ...
1
vote
1answer
30 views

Use ILmerge for NuGet libraries?

I'm making an open source C# library (http://github.com/eteeselink/fakethat if you must). Like is fashionable these days, I plan to spread it via NuGet. My library depends on another library ...
2
votes
2answers
88 views

Lazy loading if collection would have any entries

I often see model classes with properties like this: public IList<Note> Notes { get; set; } public bool HasNotes { get; set; } Where the list is initialized lazy, but the boolean property is ...
1
vote
4answers
270 views

Unit-Testing functions which have parameters of classes where source code is not accessible

Relating to this question, I have another question regarding unit testing functions in the utility classes: Assume you have function signatures like this: public function void ...
-2
votes
0answers
69 views

correct name for a method [closed]

I am struggling with a name for a method. The implementation is already done, I am just looking for a good name! potential candidates : Segregation Extract Split The Method IEnumerable< ...
0
votes
2answers
137 views

Similar references to themselves in two classes

How can I make 1 class (base, generic or something else) from these two classes? class A { A Link { get; set; } } class B { B Link { get; set; } } UPD: This is what I have now: class BSTree { ...
2
votes
2answers
175 views

Object Initializer in C# problem with readability

I wonder if object initializing have some performance gain in ASP.NET website. I have an office mate that told me that object initialization is much readable and faster than constructor. But one of my ...
-2
votes
0answers
57 views

Drawing 3D spheres in Windows Forms [closed]

I have to do a task assigned on Computer Graphics class. I need to create an application in Windows Forms that would display 3D spheres. Those are to be described in some config file (preferably) or ...
0
votes
1answer
60 views

Design question on best option to store data on remote computers

I'm making a windows forms application which I want to install on a few computers that are all connected together on a network. Each of these computers have access to a number of servers on which ...
0
votes
3answers
83 views

How to handle complex conditions? [duplicate]

We are working on project where we have to manage these conditions. i.e.: A User can save an order under these conditions: User has permission "SaveOrder" Order is in state "shipped" Online Shop is ...
6
votes
5answers
349 views

Why would a developer create a public class that has all static properties?

A previous developer has a couple public classes that do not inherit from any other classes but are filled with static properties. Is this another way of creating a struct or enum? Is this an older or ...
2
votes
3answers
365 views

Best way to check for specific types

Normally I do this: if (Animal is Dog) { Doc d = (Dog)Animal; // d. etc.. } else if (Animal is Cat) { Cat c = (Cat)Animal; // c. .... } Is this a good way or are there better ways ...
2
votes
2answers
71 views

Pattern to use for different Stages in a software

I am developing a software for a laboratory to test some devices. To test each device there are multi subtests which should be done to reach to the final result.To perform a complete test, the ...
0
votes
1answer
74 views

So Far what has the Roslyn CTP Been Used For? [closed]

All, I just wanted to know what you have or what you know other to have been doing with the Roslyn CTP. I am not asking Why would anyone invest time in Microsoft "Roslyn"?, but specifically ...
-2
votes
0answers
121 views

How to crawl a website/extract data into database C#(2012) and SQLSERVER2008 [closed]

There are few sites online who have categoriesed data/informations.I want to fetch/extract these informations and save it in my database. What are the ways/methods to get informations from websites? ...
-1
votes
2answers
147 views

c#/java or c++ (Personal question) [closed]

First of all this is not a comparison between the languages. So I've asked a question before telling that I am a beginner programmer (hardest thing done is a chat server/client when I was reading ...
-2
votes
2answers
59 views

An Algorithm for gridding a polygon in C# [closed]

There ids lots of program and algorithm for converting from bitmap into vector, but I want a simple algorithm to convert a polygon that determind with it's Points into a bitmap or mapping it on a ...
4
votes
1answer
191 views

Class Naming Conundrum

I am working on a personal project that works with databases, and in this project I have a set of classes that are similar, so they inherit from a common base class. The problem I am faced with is ...

1 2 3 4 5 27