.net-4.5

XmlDictionaryReader reading fixed-size zeroed Stream

ぃ、小莉子 提交于 2020-01-04 12:48:57
问题 Can someone give me good explanation why this has to fail? const int bufferSize = 2 * 1024, testValue = 123456; var buffer = new byte[bufferSize]; var serializer = new DataContractSerializer(typeof(int)); //Serialize value using (var memStream = new MemoryStream(buffer)) using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(memStream)) serializer.WriteObject(writer, testValue); //Deserialize value using (var memStream = new MemoryStream(buffer)) using (XmlDictionaryReader

XmlDictionaryReader reading fixed-size zeroed Stream

我怕爱的太早我们不能终老 提交于 2020-01-04 12:48:53
问题 Can someone give me good explanation why this has to fail? const int bufferSize = 2 * 1024, testValue = 123456; var buffer = new byte[bufferSize]; var serializer = new DataContractSerializer(typeof(int)); //Serialize value using (var memStream = new MemoryStream(buffer)) using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(memStream)) serializer.WriteObject(writer, testValue); //Deserialize value using (var memStream = new MemoryStream(buffer)) using (XmlDictionaryReader

VS2012 and Wix 3.6 - Installing .Net 4.5 with my application

二次信任 提交于 2020-01-04 07:17:31
问题 I am very new to the installer world. I have successfully made an .msi for my application and it is building with short-cuts and also uninstalls correctly. My next goal is to package .Net 4.5 with the installer and have it be installed prior to the installation of my application. I also have a third party application that needs to be installed. It is packaged as an msi. From what I can gather I need to develop a Bootstraper solution to have these applications install in sequence. Can anyone

Saving a BitmapImage object as a file in local storage in windows 8?

橙三吉。 提交于 2020-01-04 06:49:11
问题 I have a BitmapImage object, which already has its source etc set. I simply want to save it to my apps local storage folder, so that I can reference it at other points in the program. I just cannot figure out how to get it from object to file though! I've found solutions to similar problems for WP7, but its just not the same. Ive got as far as creating my image from a Base64 string (which works as I can load the image into a UI image viewer and see it) and have called it img , and I know I

Parallelizing a for loop with stepping in .net 4.5

試著忘記壹切 提交于 2020-01-04 04:12:21
问题 I have a function that looks something like the code below. Its purpose is to take triangle facets one at a time from an array of points where each three points is one facet, and tessellate them, replacing the facet with a list of smaller facets whose side lengths don't exceed nodeSize. Naturally, this function is time consuming for any realistic facet mesh. I'd like to refactor it to use some coarse parallelization. However, Parallel.For doesn't appear to have a way to step through indices

EF Core execute sql

孤者浪人 提交于 2020-01-03 13:35:26
问题 Am testing out Entity Framework Core, it's been well so far until i hit an error. I am not able to execute sql from a DbSet with FromSql. Error is dbset does not contain a definition for 'FromSql' The code is _context.Account.FromSql("Select * from dbo.Account"); What am i doing wrong? 回答1: It happened that I needed one more nuget package to get FromSql as well as Include to work. I added this to my dependencies in the project.json file and after the restore, Voila. "Microsoft

To run this application, you first must install .Net 4.5

你说的曾经没有我的故事 提交于 2020-01-03 07:29:10
问题 I have a wpf project that I created in VS2012, but am now trying to hack in VS2010. In the csproj file I removed the 'required version' stuff. I can open the project in VS2010, I can compile it too, but if I try to run it, I get the 'needs v4.5' message. I tried removing all the references and adding them back in again: still compiles (so all the dependencies should be on my (XP) machine). Where else should I be looking? 回答1: Check the <supportedRuntime> element in your .config file. If it's

Does the new Migrations feature of Entity Framework 5 fully support enum changes?

浪子不回头ぞ 提交于 2020-01-03 07:20:10
问题 Let's say we have the following simple model: public class Car { public int Year { get; set; } public string Make { get; set; } public string Model { get; set; } public CarType Type { get; set; } } public enum CarType { Car, Truck } Entity Framework, when adding a new Car object to the database, will store the CarType enum value as an integer. If we change the CarType enum in a way where the integer values change (change the order or add/remove values), does Entity Framework know how to

Increase stack size of main program or create a new thread with larger stack size for recursive code blocks?

空扰寡人 提交于 2020-01-03 06:43:05
问题 I've a following up question to What is the stack size of a BackgroundWorker DoWork Thread? Is there way to change it? Should I increase the stack size of my main program using the following post build event: "$(DevEnvDir)..\..\VC\bin\editbin.exe" /STACK:8388608 "$(TargetPath)" or should I capsule my recursive code block inside a new thread with a larger stack size? Thread thread = new Thread(delegate() { // do work with larger stack size }, 8192 * 1024); thread.Start(); thread.Join(); The

Customize StronglyTyped BindingSource Item Addition

余生长醉 提交于 2020-01-02 20:03:12
问题 I want to customize the addition of a new item into a BindingSource (all strongly-typed) as described on the following MSDN Article: How to: Customize Item Addition with the Windows Forms BindingSource The code below results in InvalidOperationException : Objects added to a BindingSource's list must all be of the same type. Also, the object myTypesBindingSource.Current seems to be a DataRowView with my relevant row inside. How can I customize the addition of a strongly-typed BindingSource ?