.net

Is Resharper correct?

Hi I just installed Reshaper 4.5 and it has come up with the following suggestions: return this.GetRuleViolations().Count() == 0; -- REMOVE this. new string[] { this.ID.ToString(), this.Registration } -- REMOVE string, MAKE ANONYMOUS TYPE int i = Method.GetNumber(); -- REPLACE int WITH var Should I do these? I think in some cases ...

Where does my .net assembly read its configuration from when hosted as COM?

Ok i created a .net assembly and it works fine from my asp.net website. I now want to host it as COM, so i can use it on an old legacy asp website. It kinda works, except it won't read the appsettings from the configuration file. I would think it should read it from the same folder where i registered my assembly with regasm and where th...

Where should I go to ramp up to complex .NET 3.5 and WPF applications coming from a .NET 2.0/WinForms background?

Title says it all really. I come from a C#/.NET 2.0 and WinForms background, but I'd really like to find a great WPF resource or tutorial. ...

Release Notes/History for .NET? Problem with BeginInvoke

We have some piece of code that behaves differently in two .NET versions: * 3.0.30618 (latest .NET 3.0 version) * 3.0.04506 (.NET 3.0 RTM) It does not work in the RTM version. We traced the problem to a call to system.windows.threading.dispatcher.BeginInvoke. The delegate passed never ran. Any tips or suggestions for solving this...

Create app.config file dynamically on Application startup

How can I create the app.config file programatically on Application startup (if the file doesnot exist)? ...

Partial update of WPF Animations in Storyboards/ParallelTimelines without a new Begin()?

I'm working on a WPF application that displays a number of graphical elements (RectangleGeometries and Splines) that are animated in sync with video displayed in a MediaElement. The synchronization tree is constructed as follows: Storyboard (for control: Begin(), Pause(), Seek() ...) MediaTimeline (connected to the MediaElement using...

Generate database schema from NHibernate mapping

Is it possible to generate the database schema from the Nhibernate mappings DLL? My requirements is for MySQL. If so, how do I do that? Are there tools/scripts for this? Open source/freeware tools? Additionally, can I use these tools to insert/update datasets to the database? ...

What controls the ProductVersion setting in .csproj files?

Every now and then our source control engine indicates that the ProductVersion in a .csproj file has changed. We're using VS2008 SP1. Looking through the codebase I can see two versions reported: <ProductVersion>9.0.30729</ProductVersion> and <ProductVersion>9.0.21022</ProductVersion> Does anyone know why and when Visual Studio de...

Proper way to map combo box lines to their corresponding strategy objects?

I have a situation that is pretty simple, and I'd like to know the ideal way to do it. I have a combo box. Each line of the combo box corresponds to a particular strategy object. What is the proper way to map the combo box lines to the strategy object. The way I was doing it seems overly complicated, and I'm pretty much guarantee...

Qt 4.5 .NET framework dependency

I'm currently developping an application with Qt 4.5 on Windows Vista and Visual Studio 2008 as IDE. The problem is that the program crashes on Windows XP SP2 (works perfectly with XP SP3 and Vista). This can be fixed installing the .NET framework 3.5, but I want to avoid that. Is there a way to prevent that given that I have to use th...

How to read object type hosted by bindingSource

EDIT: I changed wording, added long sample code to be more descriptive I need to read type name of object bind via BindingSource. My method accepts BindingSource as parameter and it doesnt know about object type 'hosted' by BindingSource. But I need to read that object type To explain better what I meant, assume I have 2 classes clas...

Using WeakEventManager in Windows.Forms application

When using weak events as described here http://wekempf.spaces.live.com/blog/cns!D18C3EC06EA971CF!373.entry in a Windows.Forms application the WeakEventManager leaks WeakReference objects. I think this is because without a WPF message loop the CleanupOperation is never executed, although ScheduleCleanup is called in WeakEventManager.Pro...

Best way to create a standalone program for windows without having to install pre-requisites?

Hello, I've been charged with creating a little GUI launcher app to go on a CD which will offer the user some software and some videos. It's not being aimed at particularly tech-savvy people, so it needs to be quite simple. I guess the real sticking point here is that it will be form based. I would very much like the launcher to just ru...

Encryption Algorithm for Web Applications

I have been using Symmetric (Rijndael) Key Algorithm (http://www.obviex.com/samples/Encryption.aspx) for a while to encrypt an ID. Then I URL encode the encrypted version of the ID and pass it in the query string. When I retrieve the ID from the query string, I URL decode it first and I decrypt it. A problem came up recently. If the enc...

WaitHandle.WaitAny and Semaphore class

Edit: I'd like to plead temporary insanity for even asking this question, but it made sense at the time (see edit 2 below). For a .NET 3.5 project, I have two types of resources (R1 and R2) that I need to check the availability of. Each resource type can have (say) 10 instances at any time. When one of either types of resources becomes...

Use of variables in configuration files

We often have a lot of cut and paste within a configuration file. For example we use Entity Framework, where we have 10 models, each model has it's own connection string. But within the connection string the name of the server and database are the same. At the moment if we want to change the server we must change it in 10 places. Is t...

how to create a fresh database before tests run ?

how to create a fresh database (everytime) before tests run from a schema file ? ...

The Event Log File is full

Hi all, I keep getting this error message when trying to write to the Event log from a console app. Here's how i write to it public static void WriteToEventLog(Exception ex) { string mySource = "Export Task"; if (!EventLog.SourceExists(mySource)) EventLog.CreateEventSource(mySource, "Application"); ...

C# Multi Language Application - with Community Support ?

I have to create an application whose interface will be changed by end user for his lang. and the end user may be the community which will change the all the UI details.... what will be the best way to do this? if I go with .net resources then user needs to use the settelite assemblies and that they cant make them selves. if I go for ...

How can I substitute a property during serialization with DataContractSerializer?

I have a working ChangeTrackingList implementation which does its job just fine, but I'd like to "filter" its contents when sending it from the client back to the server so that it only includes the changes. Getting the changes is easy, as my list exposes a GetChanges method for just that purpose. How can I interrupt the DataContractSeri...