Browsing 7239 questions and answers with Jon Skeet
DateTime.Now and DateTime.UtcNow don't have any culture at all. It's only when you format one as a string that it will use a culture... and which culture is used will depend on how you format it. To be clear in your code, just specify the... more 8/19/2014 5:54:43 PM
You could use a List<Tuple<string, byte[]>>... or personally I'd strongly consider creating a custom class for this - and then just have a list of them. The advantage of using a custom class over Tuple is that you can then... more 8/19/2014 5:13:23 PM
Yes, you should have a generic method instead. Personally I'd make it return a new dictionary rather than clearing an existing one, mind you... and use LINQ to implement it: private static Dictionary<int, T> Load<T>(string... more 8/19/2014 2:11:08 PM
The problem is that your Issues property is already a List<Issue>. I suspect you want something like: // TODO: Fix property naming... var project = db.Projects.Single(p => p.projectId == projectId); var issues =... more 8/19/2014 10:55:23 AM
Do not follow that code. It's terrible code more ways than I have time to go into right now. Basically, you need to get the time zone that the user is in - which may require more than just the country, as several countries span multiple... more 8/19/2014 9:10:51 AM
In your call, you're not specifying a type argument - so the compiler would have to infer the type of T. It can't do that for your second method, because the type parameter is never mentioned in the declared parameters. Therefore, that... more 8/18/2014 4:56:47 PM
Sure, just make your method return int? instead of int. Heck, then it can be even simpler: public static int? GetIntFromDB(this DataRow row, string columnName) { return row[columnName] as int?; } I'd personally do it slightly... more 8/18/2014 4:51:16 PM
The Date class isn't deprecated - just many of its constructors/methods are. You can still use: String text = new Date(millisSinceEpoch).toString(); You can't change the string format - it will always use the system default time zone,... more 8/18/2014 4:36:55 PM
If you open up the generated C# file corresponding to that type, you'll see something like this: internal static string Hello { get { return ResourceManager.GetString("Hello", resourceCulture); } } Unless you specific... more 8/18/2014 4:17:04 PM
You want to add a Book to your List<Book>... but you're not actually creating a Book instance. You probably want: Book book = new Book(bookTitle, bookAuthor); books.Add(book); ... that's after you've changed the name of your... more 8/18/2014 2:38:24 PM