.net-4.0

Horizontal orientated WrapPanel within ItemsControl lists vertically

北战南征 提交于 2019-12-04 11:36:58
问题 I have two DataTemplates defined within my XAML, each used for a seperate ItemsControl panel. The main ItemsControl lists Foo objects stored within an ObservableCollection object. The Foo object itself has its own set of items stored within as an ObservableCollection object. I tried to define the XAML in a way that allows for each of the ObservableCollection Foo items to be displayed with its name in a header (The first ItemsControl). From this the list within each Foo item itself should be

What other silent changes did happen from .Net Frameworkf v.4.0 to 4.5? [closed]

柔情痞子 提交于 2019-12-04 11:35:41
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . We want to switch to .net 4.5 cause it offers many improvements. But...sometimes I found some tricky details about not trivial changes

Disadvantages of using memory mapped files

六月ゝ 毕业季﹏ 提交于 2019-12-04 11:18:28
My web service writes several thousands of transactions per minute and we save them on the hd. I was testing different ways to save these files and I made some tests with standard IO and with MemoryMapped files. In my results, writing files (20 k text files) with MemoryMapped files is about 4x faster than standard IO and I was not able to find any disadvantages. As I have not so much experience with this technology, do you think I may face any problem using them or you don't see any disadvantage? Thanks! EDIT 1 , here the source: namespace FileWritingTests.Writers { public class

TextReader and peek next line

寵の児 提交于 2019-12-04 11:13:23
I read a data from a text file using TextReader TextReader reader = new StreamReader(stream); string line; while ((line = reader.ReadLine()) != null) { //....... } Sometimes I need to peek next line ( or a few next lines ) from reader. How do I do that? EDIT: Updated to allow any number of peeks: public class PeekingStreamReader : StreamReader { private Queue<string> _peeks; public PeekingStreamReader(Stream stream) : base(stream) { _peeks = new Queue<string>(); } public override string ReadLine() { if (_peeks.Count > 0) { var nextLine = _peeks.Dequeue(); return nextLine; } return base

Batch processing using IObservable

匆匆过客 提交于 2019-12-04 11:09:12
My server side sends me batches of messages. The no of messages in a batch and frequency is arbitrary. At times I get messages at 1 minute intervals and at times not messages for an hour. At times 1 message and at times 10. My current implementation uses Observable.Buffer(TimeSpan.FromSeconds(5)) to group and send the messages to subscriber. Instead of having to check every 5 seconds, is there a way to configure the Observable to say send your buffered messages to subscriber if there's a x seconds delay between two message. Where I am getting at is to avoid a unnecessary timer ticking every 5

Is it possible to inject an existing instance into a MEF plugin?

女生的网名这么多〃 提交于 2019-12-04 10:59:23
We are creating an application which supports plugins using MEF. We are determining what type of plugins the user is able to create, and want to use dependency injection to provide this type of plugin with the data it needs. For example, we make a plugin that is able to display a list. To achieve this, it needs the existing instance of the IRepository for the type of data the list will display. The IRepository is created somewhere else in a datacontext class, so we are unable to let MEF itself create an instance of the IRepository. My idea is to inject the existing instance of the IRepository

the application requires that assembly microsoft.reportviewer.processingObjectModel version 11.0.0.0 be installed in the global assembly cache first

元气小坏坏 提交于 2019-12-04 10:57:56
问题 I have a small windows forms application created in Visual Studio 2012 that uses ReportViewer version 11.0.0.0. The application target framework is .NET 4.0 and its deployment method is ClickOnce On my PC it installs but on client machines, intallation fails with error the application requires that assembly microsoft.reportviewer.processingObjectModel version 11.0.0.0 be installed in the global assembly cache first. On the client machines, i have installed .NET 4.0 ReportViewer 2010 Microsoft

How to create NAMED-PIPE in .NET-4?

你离开我真会死。 提交于 2019-12-04 10:48:42
How to create NAMED-PIPE in .NET-4 in your C# application? Chris Taylor Here is a piece of code to create a Named Pipe client, it is lifted from an answer to a previous question I answered on communicating between C++ and C# using Named Pipes using System; using System.Text; using System.IO; using System.IO.Pipes; namespace CSPipe { class Program { static void Main(string[] args) { NamedPipeClientStream pipe = new NamedPipeClientStream(".", "HyperPipe", PipeDirection.InOut); pipe.Connect(); using (StreamReader rdr = new StreamReader(pipe, Encoding.Unicode)) { System.Console.WriteLine(rdr

Problems with IMetaDataImport::ResolveTypeRef Method

☆樱花仙子☆ 提交于 2019-12-04 10:42:58
I have my own debugger for .NET apps that uses IMetaDataImport interface When I call ResolveTypeRef method, I always get NotImplementedException . The definition of ResolveTypeRef is like this: [ComImport] [Guid("....")] //a valid GUID [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [CLSCompliant(false)] public interface IMetaDataImport { void ResolveTypeRef( [ComAliasName("mdTypeRef")] mdToken tr, [ComAliasName("REFIID")] ref Guid riid, [ComAliasName("IUnknown**"), Out, MarshalAs(UnmanagedType.IUnknown)] out object ppIScope, [ComAliasName("mdTypeDef*"), Out] out mdToken ptd ); // ...

Chaining two functions () -> Task<A> and A->Task<B>

荒凉一梦 提交于 2019-12-04 10:33:40
问题 I don't know if I am thinking in the wrong way about TPL, but I have difficulty understanding how to obtain the following: I have two functions Task<A> getA() { ... } Task<B> getB(A a) { ... } This seems to occur often: I can asyncronously get an A. And given an A, I can asynchronously get a B. I can't figure out the correct way to chain these functions together in TPL. Here is one attempt: Task<B> Combined() { Task<A> ta = getA(); Task<Task<B>> ttb = ta.ContinueWith(a => getB(a.Result));