.net

How can I pay only once to provide the same expensive data source to multiple unit tests?

G'day! I have 4.6GB of test data in 220,000 files. A bulk test requires finding, matching, and unzipping pairs of the files. I want to run multiple unit tests across each pair. It'll take a dreadfully long time if I can't persuade the test framework to find, match, and unzip the test data only once regardless of the number of unit tests...

Unmanaged dll call to crash a dotnet app?

As part of segmenting my app into separate appdomains in order to catch and recover from an intermittent crash when calling a native dll, I need a way to reliably trigger this type of crash in order to determine if I am catching the appdomain going down correctly. I'm looking for some simple native code (C++ ?) I can compile into a dll,...

NHibernate mapping for SQL Server 2008 Hierarchy Data Type

Hi, Just wondering what the best mapping pattern is for NHibernate (latest release) with SQL Server 2008 and the hierarchy data type. Thanks ...

What is the best documented IOC framework for .net?

I am looking for the IOC/DI framework with the best documentation which would it be? ...

referencing System.Windows.Automation

Hi, I wanted to try out some of the automation stuff available through BugSlayer, but am having problems with the references. I'm trying to figure out how to reference the System.Windows.Automation library in visual studio. I have the .NET Framework v3.5 installed, and VS 2008, but neither the UIAutomationClient nor System.Windows.Aut...

DataContractSerializer, EmitDefaultValue and empty tags

I'm working on getting some objects serialized through an mvc site and returning things via xml, json, etc and I'm looking for the best way to not send the empty elements. In a perfect world, simply attaching EmitDefaultValue:=False to DataMembers in a DataContract would suffice, but in some situations, it just doesn't fly. A String de...

Using Linq find first object in list sorting by property A, then property B

I have an unordered list of Points (List<Point>) and I want to find the first Point in the list when ordering by X and then Y. NOTE: I don't want to actually change the order of the items in the List. ...

SqlDataAdapter Insert with Multiple Tables

I have a static class which loads the initial data for my c# windows forms application. The data is retrieved via 1 sqldataadapter with one query selecting from multiple sql server tables. These are then used to populate multiple datatables like so and filled into my dataset da.TableMappings.Add("Table", "ChannelTypes"); da.TableMapping...

LINQ: Doing an order by!

Hi there, i have some Linq to Entity code like so: var tablearows = Context.TableB.Include("TableA").Where(c => c.TableBID == 1).Select(c => c.TableA).ToList(); So i'm returning the results of TableA with TableB.TableBID = 1 That's all good Now how can I sort TableA by one of its column? There is a many to many relation ship betwee...

Convert BitmapImage to grayscale, and keep alpha channel

I'm having an issue with converting a BitmapImage (WPF) to grayscale, whilst keeping the alpha channel. The source image is a PNG. The MSDN article here works fine, but it removes the alpha channel. Is there any quick and effective way of converting a BitmapImage to a grayscale? ...

User defined xml transformation

I have some sample xml data, for ex: <?xml version="1.0" encoding="utf-8"?> <Account> <User> <FirstName>John</FirstName> <LastName>Doe</LastName> </User> <LoginDetails Sequence="1"> <LoginDate>01/01/09</LoginDate> <Status>Successful</Status> </LoginDetails> <LoginDetails Sequence="2"> <LoginDate>01/02/09</LoginDate> <Status>...

Difference between Environment.Exit and simple return 2 from Main

From outside of the application, is there any difference between ... Environment.Exit(2) and static int Main() { ... return 2; } ? ...

My sample app is getting crash while registering to Filechangeinfo notification

public partial class Form1 : Form { [DllImport("coredll.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong); [DllImport("coredll.dll")] static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); [DllImport("coredll.dll")] public static exte...

CustomValidator time c#.net

Hello all, I have using c#.net. I have a textbox which should contain a time. It needs to be in 24 hour format. I would like to use a CustomValidator but can’t find anything on the net. Thanks in advance for any help Clare ...

Web Services in C# .NET and objects serialization - basic questions.

Hello folks. I am trying to create a simple web service in .NET but my knowledge is limited on that subject. Here is the code of this web service: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace WebService1 { /// <summary> /// Summary description for Se...

Resharper: how to see only particular group of members

I'm using shortcut alt+\ to list all members in file. Is it a way to list only specified type of members (properties, methods, fields ...) Sometime this is very useful Eg DPack can do that by alt-p (props), alt-m (methods) ...

.NET Repeater HeaderTemplate

Hi all, Is there a way to access the field header name of a databound repeater within the header template. So insted of this.... <HeaderTemplate> <table > <th ></th> <th >Forename</th> <th >Surname<...

How can i get resources ( pictures ) from .dll file?

i put a .dll file in .net reflector then reflector shows a folder named 'Resources'. I hope to reuse the pictures in that folder. Is there a way to do that ? ...

Get HTTP requests and responses made using HttpWebRequest/HttpWebResponse to show in Fiddler

Is there any way I can hook Fiddler up to capture requests and responses made using .NET HttpWebRequest and HttpWebResponse? ...

Accessing Registry using .Net?

Hello Everyone, I am finding a strange behavior with a .Net module accessing registry using RegistryKey class. For eg I have written .Net module testcom.dll which access registry. This testcom.dll is used both by native 32 bit application and 64 bit application. My requirement is to get the value of a regkey (path being HKEY_LOCAL_MACHIN...