C# is a multiparadigm, managed, garbage-collected object-oriented programming language created by Microsoft in parallel with the .NET platform
2
votes
1answer
101 views
In what way are union types better for correctness than a common interface?
I've just recently started familiarising myself with functional programming, mostly via F#, and there's one particular functional idiom that I'm not fully understanding the benefits of. I've seen it ...
0
votes
0answers
30 views
Is there a standard to imitating an async filestream
Im trying to replace an async filestream method, which is reading data from a Hid Device and feeding it to the UI. Ive considered writing the output into a log and then importing that log again, but ...
-3
votes
0answers
57 views
Algorithm to find the next available index in a list [on hold]
I have a list of items so for example item1, item2, item3,....item10
and then I have a list of items that are marked to be deleted from that list for example item2,item5. I want my method to return ...
0
votes
3answers
179 views
Force Derived Class to Implement Static Method C#
So the situation is like, I have few classes, all of which have a standard CRUD methods but static. I want to create a base class which will be inherited so that it can force to implement this CRUD ...
0
votes
1answer
60 views
Inverse property naming (ORM scenario) [on hold]
I have a class that represents a process. In this process there are inputs boxes and output boxes.
public class Process
{
public long ProcessId { get; set; }
public virtual List<Box> ...
0
votes
0answers
39 views
How can I control the naming used when mapping foreign keys where there are more than one list of same class contained [migrated]
public class Person
{
[Key]
public int ID { get; private set; }
[Required]
[StringLength(100)]
public string PersonName { get; set; }
}
Creates "People" table
ID | PersonName | ...
-1
votes
0answers
17 views
Get the Foreign Key table data along with Requested data [migrated]
I have two tables where one table Location References(using Foreign Key relation) to another Table. I am Using Dapper i want to Get the Location Details as well for the Given Customer Table. Like the ...
0
votes
1answer
61 views
Which transaction manager will be used in WCF?
I am going through the transactions exist in WCF service but seeking some more clarification on this. I am not sure about which transaction manager WCF will use for following scenarios:
If the WCF ...
1
vote
1answer
65 views
Setting fields of a base class when using the constructor is not an option
I am refactoring a base class, implementations of which are plug-ins, loaded at runtime by another class using reflection.
The class I am refactoring uses a user ID of the form domain\user. I need ...
0
votes
1answer
33 views
DAL / Model / Application-Design Question for a MVC Application
I have a device that stores raw binary log data as a BLOB in a MySQL DB. That process is a blackbox to me (closed source) which I cannot change. I know, however, how to decode that BLOB and transform ...
-1
votes
0answers
19 views
HttpWebRequest doesn't post on jsp page for search operation, C# desktop app [on hold]
i tried many way to search on this website: https://www.ttnetmuzik.com.tr
its using JSP for search action and no form build in soruce just have onclick="searchSubmit();" for search button and button ...
-4
votes
0answers
42 views
which is the equivalent code in c# of this maked with java and bouncycastle? [closed]
Hello i can't convert this code written in java and with bouncycastle to c# . Why bouncycastle library for c# doesnt has the Cipher class? In detail i want use the Ecies cryptography like in this ...
-1
votes
0answers
11 views
How do I save a Winforms panel's drawing content to a file? [migrated]
I made a paint program, and the drawing content (from System.Drawing) is drawn on the panel. I attempted this method to do a simple save for now, and I only get a blank image.
My bitmap has its ...
1
vote
0answers
35 views
Does using membership provider in the model of a MVC project mean the model knows it is part of a website?
My basic design is that the model is in a separate project from my website, and the project never references the website. That tends to enforce the model being agnostic of how it is being used.
But ...
2
votes
3answers
51 views
Pre-processor usage to separate logic to different versions of product
In the .NET code base of a product, there are #if pre-processor statements to define whether certain functionality should be available. Like so:
shared logic
#if version1
some logic
#endif
#if ...
0
votes
0answers
44 views
Accessing a stateful managed object from native code via a static variable [migrated]
I need to create a native C++ DLL that will be an interface/wrapper over a C# class. I've never done anything like this before, but my design is basically the same as this. In other words:
I have a ...
0
votes
1answer
64 views
What possible things to log in mvc webapp [closed]
I'm about to learn to handle logging in my c# asp.net mvc app and are going to store my log in a noSQL-db. How to handle the logging is done. The thing is I'm having a hard time to figure out possible ...
2
votes
1answer
261 views
2 questions about TDD
I'm just starting to get to grips with TDD, and I have 2 quick questions;
I'm assuming that if I were writing software for a software company, that TDD would work alongside the software design? i.e ...
0
votes
2answers
87 views
Mocking the context of application
We have a context of the application which is a static class named Holder containing several static properties initialized by objects that are used throughout the application.
All over the unit tests ...
-4
votes
0answers
130 views
what is the future of mono develop after Microsoft takes .net framework to opensource? [closed]
Since Microsoft made an announcement on open source .net framework is there any chance that mono project could survive. If it can survive then what will be the primary reason ?
-1
votes
0answers
37 views
How to search for requested text backwards? [migrated]
Go to Notepad. Type in "This is a test this is a test this is a test". Put the caret to the very end of the text. Go to Edit -> Find -> Type "is" -> Set the direction to 'Up'.
Each type clicking ...
-2
votes
1answer
56 views
What's a good idea for a WEB APP to learn ASP.NET? [closed]
I used to work as a junior .NET programmer years ago. I'm looking to get back into the scene and get a job.
Lots of stuff has changed and I need to get back up to speed. I learn best by doing.
I ...
-1
votes
0answers
29 views
Analyzing the “spectrum data” of a sound file before playing it.. where do I start? [closed]
I am well versed in gathering the spectrum data of an audio file at runtime (while it's playing), but it is very limiting to the software I am writing. For this software, I need the ability to look ...
1
vote
0answers
124 views
C# structure needed for dynamic behaviour
I am using Unity to build a visualisation of a serious game. I am using the C# programming language.
My problem is that I receive data from a JSON and I parse it and I end up with a list of different ...
12
votes
2answers
858 views
How to calculate figure rotation efficiently?
I have a Figure represented through a matrix of bytes (bitmap-like matrix).
Example Figure is shown on the Picture 1.
The goal is to find the best rotation angle of some given Figure.
When Figure ...
0
votes
0answers
30 views
Decreasing MongoDB Load
I have some stream workers. They are listening to twitter stream and save into mongodb. I need to aggregate saved tweets for intermediate analyze result. I have analyzer workers. They are periodically ...
1
vote
1answer
72 views
Controller / Service - Should a service save changes to the database
I have an action on my controller called DeleteLine. This removes a line from the users basket.
My controller action looks like this:
[HttpGet]
public ActionResult DeleteLine(int orderId, int ...
-3
votes
0answers
25 views
Visual Studio Team Test: How to unit test “?” operator with only Asserts() and not using any tool [migrated]
I need to write some unit test cases to test my code in C# Visual Studio Team Test framework. Below is the method I want to test:
public static Association CreateAssociationFromXrm(Xrm.pv_association ...
1
vote
1answer
158 views
How to find duplicate strings
I allow my user to create profiles, meaning they potentially could create some with duplicate names. This can be problematic so I want to prevent them from doing so. I coded up this first pass ...
-2
votes
0answers
46 views
Adding a link label for a list of features [migrated]
I have a class that contains a list of features and I would like to add a link label for each item in that list. When doing this, I am not able to display all of the features, only the first feature. ...
0
votes
0answers
41 views
Creating a user-customizable web api
Technologies: Javascript for $http call, ASP.NET Web API, MSSQL for data retrieval
Web API will return array of widget objects with following properties:
WidgetId,
WidgetAttribute1 Bool,
...
0
votes
0answers
92 views
Good design pattern for linq to sql
I currently have a linq to sql project that was used for one project and not much work was put into it, only the generated context and entities were used. Since then the project has started to become ...
0
votes
0answers
13 views
Returning the contents of a byte Array Function C# [migrated]
I'm trying to get better at coding and more specifically, getting in to the habit of using functions to do things rather than have everything in "Main". I can't seem to find an answer which I can get ...
3
votes
1answer
128 views
Web Forms and MVC in the same web project
I'm working in a large legacy project which was build with ASP.NET Web Forms and the idea to add in the MVC libraries to the same project has been tossed around. I know that this is possible (there ...
1
vote
4answers
230 views
Order by different Enum property each row
So I have a list of DefaultSearchModal items that have an enum called TypeSearch in every list item. I would like to order the list to have a different enum property each row.
So if you have an ...
0
votes
1answer
76 views
More appropriate to validate a dependency filter parameter by mock+stub or by expression compile?
My lead is enforcing TDD on our project. He says he's following Uncle Bob (Robert Martin) and SOLID principles. One of the rules he's reinforcing is what I call "the single cog rule"--there should be ...
4
votes
1answer
208 views
Does laziness yield more race conditions?
I recently ran into a race condition while accessing a configuration setting. After examining what I could of the code, I came to the conclusion that the Configuration class' laziness1 was the source ...
1
vote
1answer
48 views
Why does a custom action filter need to inherit from both ActionFilterAttribute and IActionFilter?
I m first time creating a custom action filter and following this link http://www.asp.net/mvc/overview/older-versions/hands-on-labs/aspnet-mvc-4-custom-action-filters
They are saying to Extend ...
0
votes
2answers
121 views
how to carry a specific number of significant figures while computing? [closed]
How to carry more or less than six significant figures (4 , 5 , 7.. ) in the computation while running a program ?
i'm writing a program to solve a system of linear equations /using Gauss elimination ...
0
votes
0answers
3 views
pass data between two forms in c# [migrated]
I have a form with a button, when the button is clicked, the [public int m = 0] changes 1. I have another form [form2], when I make a new class from form1 to get m value, it passes 0 and I don't know ...
2
votes
1answer
223 views
My first SOLID re-factoring
I am trying to make use of SOLID principles for the first time. I am re-factoring a File class that stores file information and makes file operations available.
This class is then inherited to ...
1
vote
1answer
131 views
Should one write a custom IndexOutOfRange exception?
In the process of writing a special collection I utilized the already exisiting IndexOutOfRangeException as e.g. a list or array would throw if I were to access an illegal index. Code analysis tells ...
3
votes
2answers
229 views
How do you apply Single Responsibility principle to a repository
I am trying to apply "SOLID" whenever I can and try to use common sense and avoid a pattern when I see that a pattern is creating more problems than it's trying to solve. I don't want to apply a ...
-2
votes
2answers
93 views
Real World example implementation to explain Task Parallel Library [closed]
I need to provide a knowledge session on Task Parallel Library.i have not used it in any of the practical scenario.I decided to learn it by preparing for the session(may seem weird). I searched for ...
2
votes
2answers
81 views
Separation of retrieving data and business objects between DAL and BLL Layers
I did some research before posting this question. Among other questions or post, one of those is provided below. I could not get a clear mind how to determine..
Business Objects within a Data Access ...
1
vote
3answers
199 views
Is this extension method any better than just casting to an int?
The following extension method was set up in some code I maintain.
public static Int32 GetInt32(this System.Data.Common.DbDataReader reader, string name)
{
return ...
9
votes
4answers
469 views
What is the best way to initialize a child's reference to its parent?
I'm developing an object model that has lots of different parent/child classes. Each child object has a reference to its parent object. I can think of (and have tried) several ways to initialize the ...
-2
votes
0answers
19 views
OpenTK - Selection/Picking Glu.PickMatrix not sizeable [migrated]
I am using an open source OpenGL library called OpenTK, and I have some trouble with Selection Picking.
The program checks a specific matrixview ( i.e. 1x1 px) and returns the number of objects in ...
0
votes
0answers
24 views
What is the best way to initialize a child's reference to its parent? [duplicate]
I'm developing an object model that has lots of different parent/child classes. Each child object has a reference to its parent object. I can think of (and have tried) several ways to initialize the ...
0
votes
1answer
97 views
IOC Between Presentation and Infrastructure Layer
Question:
I would like to set forth dependency mapping from a *.config file from a project that has no reference to the project that contains the concrete class.
Scenario:
I'll be using terms from ...