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
1answer
12 views

alternate approach of binary serialization/de-serialization

Is it possible to convert a list of object directly to byte[] (and vice versa) to gain performance (by avoiding serialization/de-serialization)? What I have in mind is that a list is somewhere in ...
0
votes
3answers
113 views

How to design an IDisposable that unconditionally needs to be disposed?

Consider a class that implements IDisposable, and that has members in such a way that it will never become eligible for garbage collection when it is not disposed. And as it will not be garbage ...
-1
votes
1answer
38 views

assembly.GetTypes() vs assembly.DefinedTypes.Select(t => t.AsType());

public static IEnumerable<Type> GetAccessibleTypes(this Assembly assembly) { try { #if NET40 return assembly.GetTypes(); #else return ...
0
votes
1answer
36 views

Modifying XML documents using deserialization/serialization VS LINQtoXML and XPATH [on hold]

I have XML documents that I need to modify, I also have the XSD schema that defines their structure. What I did was this using XSD.exe tool I create class object from the schema in program ...
0
votes
0answers
29 views

Sproc chaining verse discrete calls from OO code

I'm currently working on a change at work to generalize a function that was sloppily coded up to work for a particular use case. The function calls a particular sproc that checks if an entity exists ...
-1
votes
1answer
60 views

Word recognition in a string without spaces or punctuation marks

I have a small C# project that reads a file and gives me an output: a string that does not contain spaces nor any types of punctuation marks. It may also contain a few misspellings. Ex. Output: ...
1
vote
1answer
134 views

Are there any valid uses for the System.Collections.Specialized classes any more?

Are there any valid uses for the classes in the System.Collections.Specialized namespace any more or are they all superseded by the classes in the System.Collections.Generic, ...
0
votes
1answer
157 views

Are VB.NET and C#.NET projects created from Microsoft Visual Studio “Open Source” safe? [on hold]

I'm developing software in VB.NET and C#.NET and planning to release their source codes as fully open source. Are these projects "open-source" safe? My doubts are: VB.NET and C#.NET are using the ...
0
votes
0answers
34 views

Repository pattern & unit of work - Issue - Timeout error [migrated]

I am implemented Repository Pattern & Unit of Work after following tutorial from microsoft ...
1
vote
0answers
71 views

Are your code-first classes your domain classes? [on hold]

When using Entity Framework does anyone else make a distinction between their code-first data classes (used to generate their DB) and their domain classes? If you don't, how do you reconcile the ...
0
votes
1answer
124 views

Should I use inheritance or an interface?

So in a nutshell I have an abstract class : public abstract class Member { public string PCode { get; set; } public string Reference { get; set; } public DateTime? ElectedDate { get; set; } } And ...
0
votes
2answers
84 views

Testing C# Eventhandler Subscription

I want my unit tests to be able to verify that some events were subscribed or unsubscribed at specific points. Currently, I see two options. VerifiableEventHandler Each client subscribes using the ...
1
vote
1answer
76 views

Best practice for projects architecture - server side [on hold]

The usual way (that I'm familiar with) to divide the server side is the n-layer architecture : DAL - data access layer, usually has the Entities and the context (and maybe include also a repository) ...
1
vote
0answers
70 views

Patterns for Implementing Resource Expansion in ASP.NET Web API [on hold]

I'd like to implement RESTful services that support Resource Expansion, so that services are self contained but if clients want to limit the number of service calls that they make, they can do so via ...
-1
votes
0answers
56 views

Entity Framework vs. Web Services [on hold]

I was curious as to what the benefits of using the Entity Framework to communicate with a database directly would be versus using web services to access data. Some background: I currently work in a ...
-1
votes
0answers
31 views

Creating a DFD for the first time [on hold]

I have been asked to make a dataflow diagram of a website I recently finished. I have researched it and honestly have came away with a vague understanding of what it should look like. I am going to ...
-2
votes
0answers
66 views

Define relation parent \child [on hold]

I have the following table ParentId id operator 12 13 * 12 14 * 12 15 * 12 1 - 12 ...
0
votes
0answers
36 views

SQL Permissions differ in SSMS and ASP.NET? [migrated]

I have created a schema and user called "WebAPI" which is used by ASP.NET project to get stock levels. So, I have simple stored procedure: SELECT p.ProductCode, SUM( sl.Qty ) AS 'Qty' FROM ...
0
votes
0answers
20 views

Compare data in a unknown size input file [migrated]

I'm writing a time sheet calculator program to go with a time clock program I wrote. I've got the inputs coded into arrays, but I'm a bit rusty and can't figure the best way to compare the data. The ...
1
vote
1answer
104 views

How can I create a set of random numbers based on a total and number of objects?

For example with: Total population = 400000 Number of villages = 800 The average population is 500 How can I randomize the amount of people in each village using a specified deviation (eg +-50) so ...
-1
votes
1answer
79 views

Moving from windows mobile 6 to windows phone [on hold]

I have been working on building applications under windows mobile for pocket Pcs for two years. now I have a large set of applications that is already built. one customer wants the same applications ...
0
votes
1answer
165 views

The problem of dependencies management

Let's consider the next situation: We have a module A which has a class Crt570 intended to interact with a device. We have a module B which uses Crt570 in the class called M100Communicator. We have ...
0
votes
1answer
60 views

A specific problem with architecturing a part of our application

Firstly, I'll try to describe the real world model of what we are trying to express in C# code. We have a device called M100. It's purpose is to read\write data from\into cards (plastic or ULTRALIGHT ...
-3
votes
0answers
52 views

Very simple sending mail application - exceptions [closed]

I would send an email from my mail adress to other mail adress. I know that here is a lot of topic about it, but I really don't know where I have mistake. What I am doing: MailAddress from = new ...
0
votes
0answers
20 views

Executing user configuration settings

For an API I'm building what it does is load an XML file that is passed to it as a string, drill to the correct element, modify values, and return the modified XML. I'm doing something like this in ...
-1
votes
0answers
50 views

Performance Difference between using ToList() vs. new List(IEnumerable<T>) [migrated]

I was curious as to the performance impact of using ToList() on an IEnumerable versus just calling the List Constructor 'List(IEnumerable)'. Example: int[] testArray = new int[10]; var list = ...
-4
votes
0answers
24 views

Could not find ildasm.exe where Developer command prompt for Visual studio 2012 points to [closed]

Today I was trying to manually run the ildasm.exe from the location where Developer command prompt for Visual studio 2012 points to i.e, C:\Program Files (x86)\Microsoft visual studio 11.0.But I ...
1
vote
2answers
147 views

Environment-aware Code

There are situations where the deployed environment (development, test, or production, for example) might dictate the outcome of certain actions. For example, perhaps a successful "user registration" ...
-2
votes
0answers
13 views

Ways to Access Monthly textboxes from given Date Range [closed]

The Scenario is you have a form with 2 Date Pickers and Label/Textbox controls for each Month. You have to enable/disable the textbox fields within the specified Date Range. I'll show you how I was ...
0
votes
1answer
101 views

Export to Excel - threading

I am working on an ASP.NET application. One requirement by the users is they are capable of exporting to Excel of some UIs. I have worked on them using the Infragistics library, and I have supplied ...
0
votes
0answers
155 views

Change code during runtime [migrated]

There is an old video of Notch debugging and testing his code and while doing so he simply pauses his game, makes his code modifications, and resume his game with the new changes. I found this old ...
0
votes
3answers
119 views

Storing a C# dictionary of type <datetime,enum> [closed]

As title says it, i'm looking for a way to store many dictionaries (one per user) of type Dictionary<DateTime,enum> in a database (sql server 2012). Each dictionary has 366 items inside and it ...
0
votes
2answers
105 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: ...
1
vote
1answer
170 views

Does the recent open sourcing of MSFT's C# compiler mean it can be made cross-platform? [closed]

I really enjoy working with C# however one of its biggest drawbacks is that it is kind of split-brained between MSFT .NET and Mono. In practice its not a big deal most of the time but it is one of ...
0
votes
7answers
630 views
+50

Is there any performance benefit in checking the item count prior to executing a foreach loop?

I saw this in code and was wondering if there is any performance benefit to checking the item count prior to looping: if (SqlParams.Count > 0) foreach (var prm in SqlParams) ...
9
votes
2answers
354 views

Compile-time IOC

Has anyone started a project to do IOC at compile time (possibly using Roslyn or Linq MethodInfo emit)? My experience with IOC containers has thus far been great, baring a few small issues Many IOC ...
-3
votes
0answers
35 views

Using win32 function in C# [closed]

I would use win32 function in C#. So what I'm doing: [DllImport("advapi32.dll", EntryPoint = "GetUserName")] public static extern bool GetUserName(String s, int n); but if I use it in main ...
0
votes
2answers
151 views

How To Invoke A Method When It's Class is Accessed (Any Method) - “OnClassEnter”

I am working on a C# net micro framework project, in particular an I2C bus management/class. I have several different I2C devices each defined in separate classes which contain all of the devices' ...
1
vote
1answer
91 views

Organising data access for dependency injection

In our company we have a relatively long history of database backed applications, but have only just begun experimenting with dependency injection. I am looking for advice about how to convert our ...
0
votes
3answers
319 views

What is the main goal of MVVM pattern? [closed]

Could you tell me what is the goal of the MVVM pattern? What are the arguments or the reasons I can give to a team and product owner to respect and develop according to this pattern? I would like a ...
0
votes
0answers
19 views

Showing different forms in diff cases, and play swf file when showing [migrated]

I need your help on my application since Im new in C#. I have a form called First.cs and two others forms such as jackpot.cs and results.cs. When application runs at once start First.cs then ...
0
votes
1answer
84 views

ASP.net performance code behind vs app_code

I am wondering about performance of a web site/application when there is code in the code behind files rather than when the code is moved to separate files in the App_Code folder. My understanding ...
1
vote
2answers
109 views

Testing ASP.NET .aspx and .ascx code behind files

I am wondering how to test .aspx.cs and .ascx.cs code behind. Can I use unit testing and if so how? Are there alternatives that will help test the functions in the code behind files? I don't know how ...
1
vote
1answer
130 views

How to get back into software development when you took a 10yr break? [duplicate]

I graduated 2004 CECS and the only experienced I had was at intern for 2 years. At that time I had c and c++ knowledge. I took a 10yrs break and now want to go back into it. I am interested in c#. ...
0
votes
1answer
84 views

Domain driven design and WCF services architecture

I am trying to figure out how to architecture my project in the DDD paradigm (a complete beginner in DDD) and stumbled upon a problem about the implementation of the web services... These are some ...
0
votes
2answers
64 views

Container/Item pattern without `friend`

I have a class Container containing objects of type Item. They are different classes, and especially they have no common base class (e.g. a Container does not itself have a Container).: class ...
1
vote
0answers
97 views

How much segregation is too much in this design?

We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results. We ...
-3
votes
1answer
38 views

Text field Form [closed]

I have 2 forms that have text input fields. One is written in JavaScript and the other in ASP NET. I would like to prevent a single symbol, the dollar or string "$" symbol from being entered into the ...
-1
votes
1answer
88 views

RESTful API Call Method Names, C# [closed]

I am working on some old code that works with a REST api in c#. The method names (what method to invoke on the API side) is being passed in as hard-coded strings. Would a static class be the best ...
1
vote
2answers
58 views

Segregating interfaces/concerns to a tree [duplicate]

When working with a single object there are a number of ways to segregate interfaces to it. Breaking it into smaller components that can be treated independently. Breaking it into simpler ...