C# is a multiparadigm, managed, garbage-collected, object-oriented programming language created by Microsoft in conjunction with the .NET platform.

learn more… | top users | synonyms

0
votes
3answers
65 views

Condensing if statement in C#

I have this if statement if (dt.Month > 3 && dt.Month < 11) { if (hours == 23 || (hours >= 0 && hours <= 6)) { session = String.Empty; } else if ...
0
votes
0answers
41 views

Generic repository unit testing best practice? [on hold]

How can I unit test my generic repository? Unit testing code: [TestClass] public class UnitTestLanguage { private IUnityContainer _unityContainer; private IUnitOfWork _uow; private ...
0
votes
0answers
19 views

How to get KML color code from colordialog box more efficiently

Kml uses an 8 digit HEX color format. The traditional Hex format for red looks like #FF0000. In Kml, red would look like this FFFF0000. The first 2 digits are for opacity(alpha). Color format is in ...
3
votes
0answers
28 views

Improve this reflection bashing code in C#

I have implemented an IDataContractSurrogate to enable serialization of ImmutableList<T> (from the Microsoft Immutable Collections BCL) using the DataContractSerialization framework. The code ...
3
votes
2answers
55 views

Refactor Linq grouping

All of the class here share these same property Country, Total and Date. Total property are integer in some classes and decimal in some classed. The extension method below has a lot of duplication. ...
0
votes
0answers
15 views

Compare Oracle Table with Sql Server Table and Update/Insert

Below is the current code wish used to update/insert records from Oracle view to Sql server table using Dapper. there is not field to check last record updated date in the oracle view so I have added ...
0
votes
0answers
11 views

Unable To set row visible false of a datagridview [migrated]

I had a DatagridView I had set its datasource From A class taskerEntities te = new taskerEntities(); var OMsMasterDescriptiveIndicators = te.MyTable.Select(x => new lccls {Id = x.Id, name = x.name ...
0
votes
0answers
8 views

Datagrid cell won't become editable [migrated]

I have a Datagrid with 5 columns. When I change a cell's value in the grid in, say, Column 2, I want to populate a listview with some products in Textbox_changed event. My XAML is: <my:DataGrid ...
2
votes
1answer
61 views

Can this LINQ lambda expression be written any better?

For the sake of knowledge, I wanted to convert a SQL query to a LINQ query expression. Here is the original SQL: SELECT CT.COURSE_NODE_ID AS CNID, CT.NODE_TEXT FROM COURSE_RELATED_VERSIONS AS CRV ...
0
votes
2answers
36 views

Does fully qualifying type name speed up your program? [on hold]

What is it called when you code like this: System.Windows.Forms.MessageBox.Show(); rather than: using System.Windows.Forms; MessageBox.Show(); I thought it was called strong typing but now I ...
2
votes
1answer
32 views

A C# class to check if one JSON tree (de-serialised as ExpandoObject / Array etc) contains another

I wrote this partly as a learning exercise in TDD. Could I please have feedback on both how to improve the quality of the code and the completeness of the tests? I used LinqPad as my IDE for this, ...
0
votes
0answers
14 views

Get datatable and filling model from it [on hold]

In my project i have a fill method. public IList<MyModel> Fill(DataTable dt) { IList<MyModel> IProperty = new List<MyModel>(); for (int i = 0; i < dt.Rows.Count; i++) ...
1
vote
0answers
66 views

Why is this RC4 code in Racket so slow?

According to shootout.alioth.debian.org, Racket is not much slower than C#, at least in the same order of magnitude due to its JIT compiler. However, I'm seeing at least two degrees of magnitude ...
3
votes
0answers
83 views

SerialPort C# Class

Originally I submitted a question here: Better Approach to Using the C# SerialPort Class I cleaned up my code a bit and rewrote a few things. I've had a number of problems along the way and I've ...
-2
votes
0answers
30 views

C# hastable and foreach loop question. syntax [closed]

http://www.homeandlearn.co.uk/csharp/csharp_s7p7.html When you setup a hashtable... why are open brackets used? Hashtable students = new Hashtable(); When setting up a Hashtable, why do we use the ...

15 30 50 per page