.net

Where can I find the .NET documentation in an easily parseable format?

I'd like to do some processing and statistics calculations over the .NET framework's classes and methods. Can I get the documentation in an easily parseable format? Or am I doomed to scrap MSDN? ...

Theoretical large volume issue, can't use collection to sort in .NET

Excuse the title of this post, but I can't really think of a more creative title. I am calling a 3rd party web service where the authors are ordering transaction results from most recent. The total transaction count is greater than 100 000. To make matters more interesting the web service sends down complex objects representing each tr...

Implementing API with replaceable backend implementation in .NET (F#)

I'm trying to understand how to implement replaceable components, or a service provider interface, in the .NET world. I suspect that I just don't know the appropriate terminology to search for. Specifically, I'm playing around with a Matrix class that has different backends. At its simplest, a matrix provides two-parameter get and set...

In C# what is the difference: string vs String

Possible Duplicate: In C# what is the difference between String and string In C# there is string and there is System.String. What is the difference between these? Is one considered better to use that the other. Are there any hidden dangers in mixing the use of them? If they are the same, then why have them both? Why not j...

What's the best way to create .NET Windows service installer?

I just created a simple .NET Windows service. My users are supposed to download it from my site and install it on their computers. So, from various forum posts (including this site) I know that in order to do this I need an installer. Or I can just give them service files and instruct how to install it. I begun with creating a setup proj...

How to keep a windows service going (.Net)

Hi everyone, I'm new to windows services, so pardon the basic nature of this post. I've been tasked with updating an existing service and had some questions about how they work and keep running in the background. I assume a loop of some sort is usually in play, but in the case below I'm not sure how it works and why it doesn't stop ...

Fault injection for .NET apps?

I am wondering if anyone knows of tools or techniques to automatically inject common faults into a running .NET program. Stuff like... Randomly inject an OutOfMemoryException upon allocation Randomly inject FileNotFoundException upon trying to access a files Randomly inject IO or Network exceptions upon using a socket. So I'm really...

MDX format_string for % doesn't multiply by 100 when % sign is at the front

For the following query: with member testVal as 0.1234 member testNormal as testVal member testPrepend as testVal, format_string="%##.00" member testMidpend as testVal, format_string="##%.00" member testAppend as testVal, format_string="##.00%" select { testNormal, testPrepend, testMidpend, testAppend} on axis (0) from [SomeRandomPlace...

Reading an XML File and Selecting Nodes in .NET

I have a heavier XML file with lots and lots of tree nodes. I need to pick-up some particular node (for example say Diet), under which there are multiple sections. ie. Diet node occurs randomly in the XML, so i need to find the node as Diet and get its child elements and save it to DB. Assume that Diet is not only one line, it has 10-1...

Why does Interlocked.CompareExchange<T> only support reference types?

Disclaimer: My posts are apparently always verbose. If you happen to know the answer to the title question, feel free to just answer it without reading my extended discussion below. The System.Threading.Interlocked class provides some very useful methods to assist in writing thread-safe code. One of the more complex methods is Compare...

Printing Large XPS file to printer..

Hi, I have an application which generates a large FixedDocumentSequence. Which has two option either to Print to a printer or save it as a XPS file format. Now, there is no issue with saving to a XPS File format. But, when you print the xps to Printer.. It takes really long time to bring the first page to printer. It wait's until the al...

How to use a custom property in a LINQ-to-Entities query

I have a class Post which is an Entities Framework model. It contains a property like this: public bool Showable { get { return this.Public && this.PublishedDate > DateTime.now } } I can use it in a query like this: from p in db.Posts where p.Showable select p; but when I have a property that uses it, like this public IEnu...

Entity Framework not sending Where clauses as WHERE clauses to SQL Server

I have a simple DB that has Sites, and each Site has a bunch of Posts. I'm trying to get all the "Public" Posts of a certain Site (I have a variable called site that is already an instance brought by EF) The first obvious thing is: var posts = from post in site.Posts where post.Public == true orderby post...

How to get all types in a referenced assembly?

For whatever reason, I can't seem to get the list of types in a referenced assembly. Not only that, I can't even seem to be able to get to this referenced assembly. I tried AppDomain.CurrentDomain.GetAssemblies(), but it only returns assemblies that have already been loaded into memory. I tried Assembly.GetExecutingAssembly().GetRefer...

How to cancel a .Net PrintDocument

If the user clicks the Cancel button while the Generating Preview window is displayed, I would like to a) Print something like * Terminated * at the end of the report, and b) notify the calling routine that the PrintDocument was cancelled. I have been able to work around (b) by adding a WasCancelled property to the report class... ...

Reducing roundtrips between client and server

Hi, We are developing desktop application in vs2008 with winforms and sql server 2008.At present, we make lot of dbase calls(linq to sql) on form load, so this make the application real slow.One option is to load all the data required at the start of application load, and store it in a cache(just static collections).What other options w...

Uneditable ViewModel properties in a edit view

In my ASP.NET MVC2 application, I have a ViewModel class called UserCreateViewModel. In this class, there are a number of properties that directly map to a LINQ-to-SQL class, called User. I'm using AutoMapper to perform this mapping and it works fine. In my Create action of the UserController, I receive a partially complete UserCreateV...

How could I take 1 more item from Linq's TakeWhile?

(line of code of interest is the last one, the rest is just for a full representation) Using the following code, I wanted to take VOTERS until I exceeded the maximum votes needed, but it stops right before reaching that maximum number of votes, so my voters pool has 1 fewer voter than I wanted. Is there a clean way in LINQ where I cou...

Does this code really cause an "access to modified closure" problem?

Taking the following code, Resharper tells me that voicesSoFar and voicesNeededMaximum cause "access to a modified closure". I read about these but what puzzles me here is that Resharper suggests fixing this by extracting the variables to right before the LINQ query. But that is where they are already! Resharper stops complaining if I m...

.NET WinForms - How to listen to events for system LogOff, User Locked, Hibernate Started and System resumed?

I want to listen to events in my windows forms .NET application for the following system wide events : Log Off Lock Windows Hibernate Started Sleep Started System Resumed Are these possible? Thanks ...