.net-4.0

Attempt by method 'System.Web.Helpers.Json.Decode(System.String)' to access field 'System.Web.Helpers.Json._serializer' failed

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 06:08:20
问题 I have the following JSON; { "b2c": { "languages": { "de": { "models": { "t300": { "name": "Aveo", "bodyTypes": { "t300-4d-my13": { "trimLevels": { "lt": { "name": "LT", "variants": { "1.2_16V_86_Gas_MT": { "name": "1.2 MT", "price": { "EUR": { "value": 13990, "formatted": "13.990,00 €" } }, "infoFeatures": { "fuel_consumption_extra_urban#consumption": { "name": "Kraftstoffverbrauch außerorts ", "value": "4.6", "formatted": "4,6" }, "top_speed#kilometer_per_hour": { "name":

How to check that all tasks have been properly completed?

依然范特西╮ 提交于 2019-12-10 03:52:05
问题 I have the following lines in my code: var taskA = Task.Factory.StartNew(WorkA); var taskB = Task.Factory.StartNew(WorkB); var allTasks = new[] { taskA, taskB }; Task.Factory.ContinueWhenAll(allTasks, tasks => FinalWork(), TaskContinuationOptions.OnlyOnRanToCompletion); But when I run this, I get the following error: It is invalid to exclude specific continuation kinds for continuations off of multiple tasks. Which is caused by the option TaskContinuationOptions.OnlyOnRanToCompletion . My

WrapPanel: Trying to make the ItemWidth equal to the max width of any one element

不羁岁月 提交于 2019-12-10 03:12:37
问题 Hopefully no one else has already asked this question, but I have searched and cannot find any mention. Feel free to point me in the right direction if I missed another question that explains this. I have a WrapPanel with data-bound items that essentially contain an icon and some variable length text (this is a legend for a chart). I really like the fact that the items appear in neat columns when I set the ItemWidth to some set value. However, due to the high variability in length of the text

Convert Dictionary into structured format string

南楼画角 提交于 2019-12-10 03:00:43
问题 I have a Dictionary object declared as var as Dictionary(of String, String) . I am trying to utilize the LINQ extensions available to the Generic Collection but am only getting the non-extension methods. I need to turn the Dictionary collection into a string with the following pattern: key1=val1, key2=val2, ..., keyn=valn Thought at first doing a foreach loop would hit the spot except the fact that i am programmers-block. What i have so far, but doubt its the best logic pattern for producing

Adding MOQ to a .NET 4.0 project is not possible

你说的曾经没有我的故事 提交于 2019-12-10 02:34:51
问题 I want to add MOQ .net library to a .NET 4.0 project. I get an error message that I should convert the project to something smaller than 4.0. I need to use .NET 4.0 also because of other project dependencies. How can I make MOQ work with a .NET 4.0 project in VS2010 ? 回答1: Make sure you have NuGet package manager installed (Tools/Extension Manager). Right click on Solution Explorer/References, choose Manage NuGet Packages. Type Moq in the search box. Install and enjoy. 回答2: The latest version

What is C# equivalent of geography sql server datatype in .net framework 4.0?

隐身守侯 提交于 2019-12-10 02:28:48
问题 net web application using .net 4.0 framework. I have a Stored Procedure which accepts geography datatype in sql server 2008 R2. I want to insert data from C# code into SQL Server. But I'm not able to find which datatype I should use in C# that is equivalent to SQL Server 2008 datatype. 回答1: If you are using entity-framework then the datatype you search is DbGeography. Here is some more information about DbGeography object -> Details. 回答2: It may sound obvious, but why not use the same data

The '?' character cannot be used here

纵然是瞬间 提交于 2019-12-10 02:26:38
问题 With these variables: Dim d1 As Date? = Nothing Dim d2 As DateTime? = Nothing Dim i1 As Integer? = Nothing Dim i2 As Int32? = Nothing Why am I allowed to do this?: Dim flag1 As Boolean = Date?.Equals(d1, d2) Dim flag2 As Boolean = Integer?.Equals(i1, i2) ...but not allowed to do this?: Dim flag3 As Boolean = DateTime?.Equals(d2, d1) Dim flag4 As Boolean = Int32?.Equals(i2, i1) The last code will fail with an error saying: The '?' character cannot be used here. 回答1: VB.NET developers are not

Simple Linq expression won't compile

半腔热情 提交于 2019-12-10 02:11:54
问题 Having these basic definitions bool MyFunc(string input) { return false; } var strings = new[] {"aaa", "123"}; I'm wondering why this won't compile : var b = strings.Select(MyFunc); But this will: var c = strings.Select(elem => MyFunc(elem)); The error message is "The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage." The Resharper error tip says it's confused between Select(this IEnumerable<string

Differences in the different ways to make concurrent programs

ぃ、小莉子 提交于 2019-12-10 01:59:17
问题 What is the difference between: Starting a new thread Using TPL Using BackgroundWorker All of these create concurrency but what are the low-level differences between these? Do all 3 make threads anyway? Thanks 回答1: They all use threads internally, the differences are to do with the abstraction level of each API and how the threads are utilised. Lets re-order your list a bit and look at the three techniques from lowest to highest levels of abstraction: Starting a new thread manually : This

Error code 5100 when installing .NET framework as part of a ClickOnce application deployment via Visual Studio 2010

痞子三分冷 提交于 2019-12-10 01:16:09
问题 Inside Visual Studio 2010, I've set my application to target version 4 of the .NET Framework and for "All CPUs". As some of our users are 64-bit while others are 32-bit, I assume one would choose All CPUs. Is that correct? On a particular user's 32-bit Windows 7 SP1 machine, the framework installation (via ClickOnce) is failing with an error code 5100, which according to this MSDN article, indicates that The user's computer does not meet system requirements . The user's PC is 32-bit Windows 7