.net

Cache with SQL dependency?

I know that NCache provides SQL dependency for Microsoft SQL Server and Oracle (10G R4 onwards). I am interested to know what other caching solutions are available, that comes with dependency on Oracle? Does Velocity, memcached, etc. support SQL dependency to receive notifications/update the cache automatically, when something changes i...

What is the format accepted by System.Net.Mail.MailAddress' parser?

I'm working on an app that's using System.Net.Mail.MailAddress and friends for sending emails. Does that parser implement the full RFC5322 or a subset or what? The MSDN is not very forthcoming on this topic. Any hints appreciated. ...

Dynamically Generated Sentences for Multi-Lingual ASP .Net Website

We are planning on adding multi-language support for our ASP .Net Website. I understand the general process of pulling strings from resource files based on the current culture, but what is the best way to deal with the following situation? Lets say that we want to display to the user how many Stack Overflow posts they have made today. L...

How to change MessageBox.Icon

Hello :D Does anyone knows how to change icons of MessageBox? I want to change to some icons made by me. Thanks. ...

How do you sign an assembly that was generated by an ILMerge operation?

I managed to use ILMerge to merge all the assemblies I have in my project into a single assembly, but the problem is there doesn't seem to be a way to sign the merged assembly. Is there some sort of command line option or command that I can run that would let me add a strong name to the merged assembly generated by ILMerge? ...

DateTime.Compare how to check if a date is less than 30 days old?

I'm trying to work out if an account expires in less than 30 days. Am I using DateTime Compare correctly? if (DateTime.Compare(expiryDate, now) < 30) { matchFound = true; } ...

How do I change the cursor for a ToolStripButton?

I want to change the user's cursor when they hover over a specific ToolStripButton, but not for the other items on the ToolStrip. How do I set the button's cursor? ...

.NET best practices?

I know it is a broad topic but I'm interested in any of .NET's so-called best practices, though I'm looking for less obvious ones, unlike "use as instead of casting". Let's see what interesting things I can learn from Stack Overflow users. ...

P/Invoke, Pinning, and KeepAlive Best Practices

At work we have a native C code responsible for reading and writing to a proprietary flat file database. I have a wrapper written in C# that encapsulates the P/Invoke calls into an OO model. The managed wrappers for the P/Invoke calls have grown in complexity considerably since the project was started. Anecdotally the current wrapper is ...

Type.GetInterface and nested types

Hi, I just discovered a very strange behavior with Type.GetInterface and nested Types. The following sample code will show the problem, I am using the Type.FullName of an interface to check whether a given type derives from that interface: public interface IStandardInterface {} public class StandardClass : IStandardInterface {} class...

How should I design a class library to allow for IoC, but not depend on a particular container

I'm developing a class library that will be used in a number of different web applications, and possibly even made available as an open source project. There are several points where I would like to use IoC, but I don't want consumers of the class library to have to use one particular implementation. What is the best way to design this...

How can I execute multiple Oracle SQL statements with .NET

As a part of our build process we want to execute SQL Scripts consisting of DDL and DML statements against a fresh database instance. ADO.NET Connection/Command can't handle this without parsing and splitting the scripts. The sqlplus command line utility can execute scripts only interactively, and isn't suited for batch usage. What a...

Do Strongly Typed Datasets improve performance?

Where I work we're finally coming around to the idea of using strongly typed datasets to encapsulate some of our queries to sqlserver. One of the idea's I've been touting is the strength of the strongly typed column's, mainly for not needing to cast any data. Am I wrong in thinking that strongly-typed-datasets would improve performance ...

Open page in same browser window from winforms app

I have a .NET winforms program that includes a feature to launch a specific web page in the system's default browser window. It would be desirable for the page to be launched in the user's existing browser window, if one is open. The current means of launching the browser always creates a new window: Process p = new Process(); p.Sta...

Is there a better way (besides COM) to remote-control Excel?

I'm working on a regression-testing tool that will validate a very large number of Excel spreadsheets. At the moment I control them via COM from a Python script using the latest version of the pywin32 product. Unfortunately COM seems to have a number of annoying drawbacks: For example, the slightest upset seems to be able to break the c...

What is the App_Data folder used for in Visual Studio?

When creating a new ASP.NET application in Visual Studio, a couple of files and folders are created automatically. One of those folders is called App_Data. Also when publishing a website by selecting the menu option Build->Publish a checkbox is available Include files from the App_Data folder. Am I right assuming that the files put in ...

How can I create a wizard in .NET?

How can I write a wizard in Visual Studio/.NET to generate code and insert it in a form? ...

Why aren't classes like BindingList or ObservableCollection thread-safe?

Time and time again I find myself having to write thread-safe versions of BindingList and ObservableCollection because, when bound to UI, these controls cannot be changed from multiple threads. What I'm trying to understand is why this is the case - is it a design fault or is this behavior intentional? ...

C# type inference : fails where it shouldn't?

Notice the following code. The offending line has been commented out. interface I<R> { } class C : I<int> { } class Program { private static void function<T, R>(T t) where T : class, I<R> { } static void Main(string[] args) { // function(new C()); // wont compile function<C, int>(new C()); } } ...

Exchange Message Tracking log - extracting email send failures

Our Exchange server generates about 100MB of message tracking logs per day. Deep inside these logs are email send failure reports that we want to extract. We have a transactional site that sends confirmation emails to the customer at the end of the transaction. We require the user to enter their email address twice, in two textboxes. If...