.net

Regex check previous line

Using regex (in c#.net) is it possible to check the previous line of a string? For instance, I need to select strings in which the previous line is not a series of asterisks (prev line:******) ...

Is there such a thing as an automatic build in any IDE for .NET?

I'm not talking about a continuous build process, but the excellent feature in Eclipse whereby any java code changes are automatically built in a background thread. With this enabled, running unit tests or applications is immediate. Going back to the 'manual' builds of VS20XX is quite painful. I've only seen this working in Eclipse for ...

Timer for a polling windows service

I wrote a Timer class in order to use it within a windows service that is polling another system. I did this because I had two issues that the System.Timers.Timer is not addressing. The Elapsed EventHanler is running in background and so its execution will abort if the main thread ends. I wanted the System.Timers.Timer.Stop function to...

Microsoft Terminal Services

Any idea about opening a remote app (Microsoft Terminal Services) on client through .Net? ...

How do I mock an IEnumerable<T> so that I can test a method that receives it

I have a method that I want to test which expects an IEnumerable<T> as a parameter. I'm currently mocking the contents of the IEnumerable<T> as follows (Using Moq): var mockParent = new Mock<ICsvTreeGridExportable>(); var mockChild = new Mock<ICsvTreeGridExportable>(); How do it put these mocked objects inside an IEnumerable<T> so ...

How do I delete dynamically created button control from canvas using WPF

I have created nearly 40 to 60 button controls dynamically on canvas control using WPF. Now I want to remove the selected button control from the canvas. How do I do this. ...

Operator Overloading in C# - Where should the actual code code go?

A bit of a conceptual question: I'm creating my custom structure, in the vein of a Vector3 (3 int values) and I was working through overloading the standard operators (+,-,*, /, == etc...) As I'm building a library for external use, I'm attempting to conform to FxCop rules. As such, they recommend having methods that perform the same f...

C# Assigning a value to DataRow["haswhatnots"] = hasWhatnots is awful slow.

C# Assigning a value to DataRow["haswhatnots"] = hasWhatnots is awful slow. hasWhatnots is a boolean value. I have profiled this line and with 560000 hits the execution time is 82 seconds. Of course the profiler has some effect on the performance, but still the performance of this is grazy slow! Any hints on the issue. The DataRow is p...

Deploying a WCF service to the shared host environment

I created a very simple WCF class library and added this project to the solution that has a web project. I added a reference to the service from the web project. Locally, everything works as expected. When I do a copy site to my hosting provider, I get all sorts of errors. Currently I have this error: Parser Error Message: The binding ...

At what point in a Windows Form closing process do the Controls get invalidated?

I've recently set some coursework for some undergraduate students for which they have to use a small and relatively simple C# library provided to them. The main purpose of this library is to display a simple form which is composed of a coloured grid (which they can manipulate), a number of buttons and a label with some text. The class ...

change web.config appsettings based on globalization setting

Hi, I am using common code for 2 different international sites but with different web.config settings. I'd like to keep both sets of the appsettings in the same web.config file and just change the globalization settings for each installation. Is there anyway to do this? ...

How to Architect an offline database

Using Sql Server 2008, .Net 3.5 & C#. I am designing a desktop application that runs in a read-only state when there is no internet connection. When the connection is available again it will use webservices to update the central DB. What technologies could I use to 'download' a set of data applicable to each client for use offline? ...

.NET Garbage Collector mystery

In my job we had a problem with OutOfMemoryExpections. I've written simple piece of code to mimic some behavior, and I've ended up with the following mystery. Look at this simple code which blows up when it runs out of memory. class Program { private static void Main() { List<byte[]> list = new List<byte[]>(200000); ...

How to cancel an asynchronous calls?

The title says it all. How to cancel an asynchronous calls? The .NET APM doesn't seem to support this operation. I have the following loop in my code which spawns multiple threads on the ThreadPool. When I click a button on my UI, I would like these threads (or asynchronous calls) to end. foreach (var sku in skus) { loadSku.BeginIn...

Creating a Style in code behind

Hi, Does anyone know how to create a wpf Style in code behind, I can't find anything on the web or MSDN docs. I have tried this but it is not working: Style s = new Style(typeof(TextBlock)); s.RegisterName("Foreground", Brushes.Green); s.RegisterName("Text", "Green"); breakInfoControl.dataTextBlock.Style = s; Cheers, James ...

Linq operations against a List of Hashtables?

I'm working with a set of legacy DAO code that returns an IList, where each Hashtable represents the row of a dynamically executed SQL query. For example, the List might contain the following records/hashtables: Hashtable1: Key:Column15, Value:"Jack" Key:Column16, Value:"Stevens" Key:Column18, Value:"7/23/1973" Key:Column25, Value:"Act...

How to Export Images from an Image List in VS2005?

Using Visual Studio 2005, is there a way to export the images in an Image List to individual files on my PC? Using the IDE, I select the Image List and view its properties. In the "Images" property, I launch the Images Collection Editor dialog. I can only add and remove images, but I cannot find a way to export an image that is alread...

int.TryParse = null if not numeric?

Hello is there some way of return null if it can't parse a string to int? with: public .... , string? categoryID) { int.TryParse(categoryID, out categoryID); getting "cannot convert from 'out string' to 'out int' what to do? EDIT: No longer relevant because of asp.net constraints is the way to solve problem /M ...

Using Unreal 3 Engine within a .NET application

Now that the Unreal Development Kit for Unreal 3 engine is free I am thinking about utilizing it for an appication. Do you think it is possible to emebedd a Unreal 3 powered 3D window into a .NET (WPF or Windows Forms) and control parts of the gameobjects therein using c#? Is the engine plain c++? Or COM or is there a .NET wrapper or som...

what is difference between Exception handling Application block & Exception handling

what is difference between Exception handling Application block & Exception handling in regular dot net classes ? i don't think it is beneficial to use of Exception handling Application block. What is exact use of that block ?? ...