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
3answers
1k views

Proper Query Object Pattern - NHibernate

I was looking to an alternative to Repository Pattern and I've read about "Query object pattern" (http://lostechies.com/jimmybogard/2012/10/08/favor-query-objects-over-repositories/). However the ...
-4
votes
0answers
81 views

What so great about interface? [duplicate]

I am trying to dig in about "INTERFACES". So to understand I did a small demo in 2 ways. One with Interface and other without it. The result is same in both ways, the what is so great about interface. ...
0
votes
1answer
51 views

Linking kernel voids without CPU parse (Compute shaders)

Is it possible to parse data between compute shader voids without having to create a new buffer and cpu link (Using unity with C# interface). For example I have a kernel with position data on a set ...
2
votes
1answer
266 views

How to backup data and images in this project?

I have MS C# and MS SQL 2008 database project. It can capture employees' records with pictures of more than 1000 records. Presently, I'm able to capture say 150 records on PC1 using my installed C# ...
2
votes
1answer
89 views

Thoughts on having a generic, reusable grid viewmodel

I'm developing a wpf-based application and I'm currently struggling to find the best way of supporting a recurring scenario in it. This app uses grids a lot. There are a bunch of features I want in ...
2
votes
3answers
235 views

What strategy to follow while matching sql server datatypes in C# Code First approach while using Entity Framework

While matching SQL Server datatypes with C# Code First Approach in Entity Framework, what are specific points that we should keep in mind so that our C# datatype should match exactly our SQL Server ...
4
votes
3answers
283 views

Functions whose parameters are implicitly supplied

Callback functions are able to accept some parameters, but they are not explicitly declared when calling the function. How does this actually work? What is going on that allows us to pass a function ...
5
votes
2answers
162 views

Should I have a separate XML settings file for my application?

I want to be able to add some objects to my application by simply adding a XML node to a config file. Should I put it in the app.config file or should I make a separate XML config file? A node would ...
0
votes
1answer
215 views

Is there a way to do bitwise operation with more than two state

I know how make bit operation. I'm wondering if you need more than 2 states is there a way to do it using bit instead of array and % operators. Because those are really slow. So in case the array ...
0
votes
0answers
42 views

C# Implementation of Perl MD5->Digest method [migrated]

I have this code on Perl use Digest::MD5; use MIME::Base64; $ctx = Digest::MD5->new; $ctx->add('fredy'); print "Line $.: ", $ctx->clone->hexdigest, "\n"; print "Line $.: ", ...
7
votes
6answers
4k views

What are the advantages and disadvantages of using Resharper Annotations? [closed]

A new colleague has mooted the idea of using Resharper annotations within our code base (we already are great fans and users of Resharper). My new colleague cites things like explicitly stating ...
1
vote
2answers
858 views

Tree View Children condition indicator on topmost un-expanded parent

I am using a tree view in c# and i am creating custom icons for the nodes. Let say this is my hierarchy with a node that satisfies a certain condition: Root1 |_Ax |_Bx1 |_Bx2 |_Cx1 ...
1
vote
3answers
321 views

How to design a class for a fixed-length id?

I'm building an app in C# that needs a fixed-length id, which is a string representation of a hex number. E.g. "0fa5" is an example of such an id of length 4. The length would not need to change ...
0
votes
1answer
366 views

How to test model binding within an MVC controller when Bind attribute with Include list is used?

Auto-generated action methods in MVC5 make use of the BindAttribute with an Include list that contains the field names in a string literal. Example: // POST: MyTable/Edit/5 // To protect from ...
1
vote
2answers
772 views

How I could update a DB table using a POCO class bound in a DataGridView

I try to explain better using an example: I create the class Product with attibutes like that: private string _ProductCode = ""; [DisplayName("ProductCode")] public String ProductCode { get { ...
0
votes
0answers
23 views

Microcontroller oLED Display Buffering Optimizations or Alternatives For Speed?

I'm developing a UI/Layout for a 128 x 64 oLED Monochrome Pixel Display. I've got a small netMF microcontroller driving the display via SPI at 40mhz. I'm using some basic methods, like these here, to ...
0
votes
1answer
118 views

When to implement WCF Rest Service and WebApi

I have gone through many articles to understand why we need WebApi's when we can create restful architecture using WCF rest services but could not find some solid reason. Can we use these ...
1
vote
3answers
656 views

Gathering IP address and workstation information; does it belong in a state class?

I'm writing an enterprisey utility that collects exception information and writes to the Windows Event Log, sends an email, etc. This utility class will be used by all applications in the corporation: ...
2
votes
2answers
110 views

Correct approach for creating api contract

I am trying to design an API. For creating contracts below are the two approaches: Approach 1: public class MyController { public void MyAction1(Dictionary<string, dynamic> input) { ...
3
votes
3answers
73 views

Determine frequency-range that matches closest to input list of frequencies

Since this question is not about "code not working", I'm asking my first question here instead of StackOverflow. Inform me if any required information is missing from the question. Setup: I ...
0
votes
0answers
57 views

Is using a self-hosted service a viable option for launching applications from a url?

We have a third party supplied application with a button that enables the opening of another application showing related data when pressed (these applications are made by completely different ...
1
vote
1answer
355 views

Is it possible to avoid a lot of using statements?

Lets say I have a simple code like this (fiddleLink): using System; public class Program { public static void Main() { //Dependency register logic here var service = new ...
1
vote
1answer
171 views

Could a class with only auto properties could be a new language type and act like an interface?

Would it be useful define a type in C# that defines something similar to a data table so it can be instantiated but may not contain logic and also act as an interface? In addition I'm thinking this ...
-2
votes
0answers
17 views

Webview rendering problems with c# XAML vb 2013 [migrated]

I'm trying to create a XAML app for windows tablet and for some reason it's not displaying (some) webpage correctly. It shows up fine when I try to access the erroneous webpage using Internet ...
-1
votes
3answers
98 views

Integer conversion with Console.ReadLine() [closed]

To read an integer from user input, you can use: int number = Convert.ToInt32(Console.ReadLine()); But why won't the following work? int number = (int) Console.ReadLine(); What's the difference ...
1
vote
0answers
121 views

How to scale a C# server application

I'm writing a pretty simple TCP server/client application for the first time. It is a personal project for education, but I really like my applications to be extendable and to scale in case the code ...
0
votes
1answer
46 views

How to handle the default time when user is selecting dates to filter on?

We have an ASP.NET application which allows users to report on their data. We have a number of reports that the user selects the start and end date from a datepicker and then we returned the filtered ...
1
vote
1answer
229 views

Clarification about Event Producer in StreamInsight

I need a small clarification about StreamInsight, I know by doc's that StreamInsight can handle multiple concurrent Events. But will the event producer be a separate function, for ex: I need to watch ...
1
vote
2answers
139 views

User and role modeling

I'm working with a system in ASP.NET MVC, with Entity Framework for ORM. The application has a requirements to allow users to have different types of roles, and authorization rules will be different ...
2
votes
2answers
234 views

Why does this use of IEnumerable, List, and Arrays seem to get modified when it shouldn't be?

I have started learning c# and am confused by the following feature. The following code uses a function Algs.Combinations(n,m) to produce an IEnumerable which contains the combinations of n objects ...
1
vote
1answer
221 views

How shall I project CQRS command and query services through WCF

I got directed to this site for more conceptual questions. Here is my issue: Im designing an application that uses CQRS to expose functionality to higher levels in the stack. This looks like below ...
1
vote
1answer
177 views

How to handle custom logic for multiple customers

We got a project where we have to process certain requests which the customer sends. The request is either in a generic format or in a customer format (all xml) which is then converted to the generic ...
16
votes
5answers
6k views

Using static classes as namespaces

I have seen other developers using static classes as namespaces public static class CategoryA { public class Item1 { public void DoSomething() { } } public class Item2 { ...
7
votes
5answers
16k views

Efficient methods for storing tens of millions of objects for querying, with a high number of inserts per second?

This is basically a logging/counting application that is counting the number of packets and counting the type of packet, etc. on a p2p chat network. This equates to about 4-6 million packets in a 5 ...
1
vote
1answer
42 views

Is it safe to include connection data in token?

When generating a ClaimIdentity for use by oAuth in generating a token, is it safe to include database information as a claim? My application uses a different database depending on the specific ...
0
votes
0answers
106 views

Enterprise Mashups. A good approach for .net

I'm in the middle of trying to talk our management into letting us do a portal that sits across the many, many systems that we use. I believe in using the best tool for the job so we have a good ERP, ...
3
votes
4answers
861 views

If possible, would it be a bad practice to use Nullable for non value types?

Update After writing this question I found out that Nullable<T> has a type constraint of struct on T so you cannot actually use Nullable for reference types. However, some good answers ...
1
vote
2answers
207 views

Alternatives to using dictionary in parameters in C#?

I have a method that takes in a dictionary and enum value and produces a string output. Enum value defines what template string to insert the dictionary key value pairs into. public string ...
1
vote
3answers
184 views

Design pattern for different code behaviors according to different clients

At my company, we have a solution composed of a WinForm (multiple per client) and an API (one per client). This solution is deployed on different clients that require the solution to behave ...
0
votes
1answer
475 views

A CLR SQL Server Stored Procedure calling an ASP.NET Web API

We are developing a big system with SQL Server database, ASP.NET Web API 2.2 services and another external services. We need to load more data on a table while we process the current data on it. To ...
2
votes
2answers
104 views

Is there any reason to write delegates/events for one class?

I have a game with such events as GameOver, GameStart, PlayerWin, etc. I only have one class that is listening on these events, for the purpose of sending these events as TCP json messages to a client ...
2
votes
1answer
72 views

Class structure for Entity Framework

I'm using EF (Code first) and I'd like to isolate the properties from the methods (many of the methods reference other libraries that I don't want my database project to have to reference). As an ...
1
vote
1answer
178 views

Could there be a use case for C# style auto-properties in Python

I've been doing a lot of work in C# recently (my primary language is Python) and I love that I can do something like public string MyProperty{ get; set; } Going back to Python I miss that sort of ...
0
votes
1answer
72 views

Is it good practice to assign an instantiated class to a static property in the same class?

I have code that was written by someone else that goes like this: On a ViewModel: public static ACertainViewModel Default { get; private set; } On the same ViewModel's constructor: public ...
1
vote
1answer
92 views

Accepted Patterns For Base Class with both Static And User-Defined Data Sources

I have a requirement to build a 'base' profile library (in C# - NET 4.5.2) for various different internal (technical) consumers. This profile consists of metadata fields that would be shared by a ...
0
votes
3answers
136 views

C# — Is there a key/key lookup table type provided in .NET?

It seems like a pretty straightforward thing to add, but I just want to be sure .NET doesn't already provide one and save me from adding unnecessary code: I need a lookup table (like a Dictionary) ...
1
vote
2answers
91 views

How do I write a proper messaging protocol?

I need to write a messaging protocol between client and server for a game application. I need to send messages back and forth such as, Player joined a game, player left game, player performed this ...
3
votes
1answer
352 views

Separation of concerns between repository and service in DDD with complex entities

This probably seems as an example of opinion-based question, but I'm actually looking for rationale on how to decide correctly, I believe there is a correct solution that can be backed by solid ...
7
votes
3answers
338 views

Should I make my own exceptions, or co-opt similar exceptions for slightly non-standard purposes?

This is a general design question, but I'm focusing on C# and .NET because those are the languages I'm working with right now. Should I create my own, new exception classes, or co-opt existing ...
1
vote
1answer
147 views

C# Refactoring Code OOD and SOLID [closed]

I’m having some questions regarding improvement of code structure and maintainability, especially regarding SOLID. These questions are specifically for this project, so I would be happy if this ...