Skip to main content
Filter by
Sorted by
Tagged with
118 votes
6 answers
78k views

This Imgur api call returns a list containing both Gallery Image and Gallery Album classes represented in JSON. I can't see how to deserialize these automatically using Json.NET given that there is ...
Peter Kneale's user avatar
  • 1,946
117 votes
17 answers
118k views

Some guy asked me this question couple of months ago and I couldn't explain it in detail. What is the difference between a reference type and a value type in C#? I know that value types are int, bool,...
tugberk's user avatar
  • 58.7k
662 votes
7 answers
406k views

How do I use the HTML Agility Pack? My XHTML document is not completely valid. That's why I wanted to use it. How do I use it in my project? My project is in C#.
user avatar
1517 votes
23 answers
1.4m views

I am playing with LINQ to learn about it, but I can't figure out how to use Distinct when I do not have a simple list (a simple list of integers is pretty easy to do, this is not the question). What I ...
Patrick Desjardins's user avatar
340 votes
9 answers
395k views

I am trying to extend the JSON.net example given here http://james.newtonking.com/projects/json/help/CustomCreationConverter.html I have another sub class deriving from base class/Interface public ...
Snakebyte's user avatar
  • 3,775
2271 votes
76 answers
860k views

Given a DateTime representing a person's birthday, how do I calculate their age in years?
246 votes
10 answers
819k views

I'm trying to deserialize a Facebook friend's Graph API call into a list of objects. The JSON object looks like: {"data":[{"id":"518523721","name":"ftyft"}, {"id":"527032438","name":"...
user avatar
817 votes
31 answers
606k views

I'm looking for the fastest way of inserting in Entity Framework. I'm asking this because of the scenario where you have an active TransactionScope and the insertion is huge (4000+). It can ...
Bongo Sharp's user avatar
  • 9,638
72 votes
4 answers
24k views

Look at the following example (partially taken from MSDN Blog): class Animal { } class Giraffe : Animal { } static void Main(string[] args) { // Array assignment works, but... Animal[] ...
AndiDog's user avatar
  • 70.6k
405 votes
86 answers
151k views

After discussion with colleagues regarding the use of the 'var' keyword in C# 3 I wondered what people's opinions were on the appropriate uses of type inference via var? For example I rather lazily ...
1214 votes
16 answers
1.1m views

I can't get to the bottom of this error, because when the debugger is attached, it does not seem to occur. Collection was modified; enumeration operation may not execute Below is the code. This is a ...
cdonner's user avatar
  • 37.8k
491 votes
12 answers
473k views

Is there a simple method of parsing XML files in C#? If so, what?
domoaringatoo's user avatar
280 votes
3 answers
286k views

I don't quite understand the difference between Task.Wait and await. I have something similar to the following functions in a ASP.NET WebAPI service: public class TestController : ApiController { ...
ronag's user avatar
  • 51.6k
361 votes
20 answers
502k views

Is there a default/official/recommended way to parse CSV files in C#? I don't want to roll my own parser. Also, I've seen instances of people using ODBC/OLE DB to read CSV via the Text driver, and a ...
David Pfeffer's user avatar
1311 votes
10 answers
2.0m views

Let's suppose if we have a class like: class Person { internal int PersonID; internal string car; } I have a list of this class: List<Person> persons; And this list can have ...
test123's user avatar
  • 14.3k
1366 votes
29 answers
1.4m views

What's the best way to convert a string to an enumeration value in C#? I have an HTML select tag containing the values of an enumeration. When the page is posted, I want to pick up the value (which ...
Ben Mills's user avatar
  • 28.8k
477 votes
34 answers
309k views

Is there any way I can separate a List<SomeObject> into several separate lists of SomeObject, using the item index as the delimiter of each split? Let me exemplify: I have a List<SomeObject&...
Felipe Lima's user avatar
  • 10.8k
451 votes
15 answers
405k views

My code is as below public CountryStandards() { InitializeComponent(); try { FillPageControls(); } catch (Exception ex) { MessageBox.Show(ex.Message, "...
Kuntady Nithesh's user avatar
243 votes
22 answers
428k views

I'm a C#/Windows Forms programmer with more than 5 years experience. I've been investigating WPF using the MVVM (Model-View-ViewModel) design pattern. I have searched the Internet for tutorials. I ...
JP Richardson's user avatar
739 votes
30 answers
823k views

I am using the autocomplete feature of jQuery. When I try to retrieve the list of more then 17000 records (each won't have more than 10 char length), it's exceeding the length and throws the error: ...
Prasad's user avatar
  • 59.6k
157 votes
3 answers
183k views

Given the following JSON object, form = { "name": "", "address": { "street": "", "city": "", "province": "", "postalCode": "", "country": "" }, "phoneDay": "", "...
Shaun Luttin's user avatar
1655 votes
42 answers
206k views

Given a specific DateTime value, how do I display relative time, like: 2 hours ago 3 days ago a month ago
736 votes
20 answers
472k views

I have a condition in a silverlight application that compares 2 strings, for some reason when I use == it returns false while .Equals() returns true. Here is the code: if (((ListBoxItem)lstBaseMenu....
Drahcir's user avatar
  • 12.7k
683 votes
18 answers
591k views

I'm trying to make a custom authorization attribute in ASP.NET Core. In previous versions it was possible to override bool AuthorizeCore(HttpContextBase httpContext). But this no longer exists in ...
jltrem's user avatar
  • 12.6k
594 votes
18 answers
351k views

I am new to asynchronous programming with the async modifier. I am trying to figure out how to make sure that my Main method of a console application actually runs asynchronously. class Program { ...
danielovich's user avatar
  • 9,727