.net

Two directional list Enumerator in .NET

In my c# app, I've got a list that I navigate with an Enumerator. It works great for moving forward through the list, but the Enumerator class doesn't have a MoveBack method. Is there different class that has a MoveBack method, or do I need to write my own? ...

How can I create a custom Property for my assembly?

How can I create a custom property for my .Net assembly which would then be visible under the Details tab in Windows explorer? Something to sit parallel with "File Description", "Type", "Product Version"... etc Update: To quote my comment to Lars ... "Whilst I would have liked to do this from within Visual studio, that is certainly not...

WCF - returning large images - your experience and tips on doing so

We are using a WCF service layer to return images from a repository. Some of the images are color, multi-page, nearly all are TIFF format. We experience slowness - one of many issues. 1.) What experiences have you had with returning images via WCF 2.) Do you have any suggestions tips for returning large images? 3.) All messages are se...

Are there any classes (or methods) that can create a formatted connection string, given a provider name and user id, password etc?

Eg. ConnectionDetails cd = new ConnectionDetails (); cd.ProviderName = "System.Data.OleDb"; cd.DataSource = "serverAddress"; cd.Catalog = "database"; cd.UserId = "userId"; cd.Password = "password"; string connectionString = cs.CreateConnectionString(); // Should return: // "Provider=SQLOLEDB;Data Source=serverAddress;Initial Catalog=da...

How do I profile a SQL CLR application?

I have a SQL CLR function in SQL Server 2005. I want to profile this function to make sure there are no memory leaks. Any recommendations on how to determine if my function is behaving properly? ...

Castle Windsor: How to wire up a component to a factory property rather than method

I have the following component public class MyTimer : IMyTimer { public MyTimer(TimeSpan timespan){...} } Where timespan should be provided by the property ISettings.MyTimerFrequency. How do I wire this up in windsor container xml? I thought I could do something like this: <component id="settings" service="MySample.ISettings...

Index of Linq Error

If I have the following Linq code: context.Table1s.InsertOnSubmit(t); context.Table1s.InsertOnSubmit(t2); context.Table1s.InsertOnSubmit(t3); context.SubmitChanges(); And I get a database error due to the 2nd insert, Linq throws an exception that there was an error. But, is there a way to find out that it was the 2nd insert that had...

How do I create Keyboard Shortcut Chords in my own Winforms Application

I want to create a component that allows us to have keyboard shortcut chords associated with an arbitrary command like the visual studio IDE does. ...

Test to see if an image exists in C#

I am writing a diagnostic page for SiteScope and one area we need to test is if the connection to the file/media assets are accesible from the web server. One way I think I can do this is load the image via code behind and test to see if the IIS status message is 200. So basically I should be able to navigate to within the site to a ...

Is there a way to extract .NET 2.0 from the .NET 3.5?

.NET Framework 3.5 SP1 installs the .NET Framework 2.0 SP2 and the .NET Framework 3.0 SP2 behind the scenes. These installation packages (especially .NET Framework 2.0 SP2) are not available directly from Microsoft. Is there a way to extract them from the .NET Framework 3.5 SP1 installation package? ...

How does one tell if an IDisposable object reference is disposed?

Is there a method, or some other light-weight way, to check if a reference is to a disposed object? P.S. - This is just a curiousity (sleep well, not in production code). Yes, I know I can catch the ObjectDisposedException upon trying to access a member of the object. ...

Where to put extra functionality for the database layer (Linq-to-SQL)

What would be the best method to implement extra functionality in a database layer that uses Linq-to-SQL? Currently I'm looking at implementing functions for adding information based on presets and similar tasks? Inserts, updates and deletes requires access to the DataContext and in the Table classes you don't have access to the context...

Is there a way in .NET to have a method called automatically after another method has been invoked but before it is entered

What I am looking for is a way to call a method after another method has been invoked but before it is entered. Example: public class Test { public void Tracer ( ... ) { } public int SomeFunction( string str ) { return 0; } public void TestFun() { SomeFunction( "" ); } } In the example above I would like ...

Setting a log file name to include current date in Log4j

I would like to set the log file name for a log4j and log4net appender to have the current date. We are doing Daily rollovers but the current log file does not have a date. The log file name format would be logname.2008-10-10.log Anyone know the best way for me to do this? edit: I forgot to mention that we would want to do this i...

Connecting to Informix database from .Net

What's the best way to connect to a Informix database from .Net? I'm developing a client-server application based on a legacy Informix DB which used to be connected by JDBC. I need it, from the most important to the least: To be fast DB server changes not needed No ODBC and no dependencies, other than de .Net Framework 2.0 Thanks i...

[.NET] Use asynchronous delegates or ThreadPool.QueueUserWorkItem for massive parallelism?

I have a .NET application that processes around 300,000 records in a batch import, and it takes a few seconds per record so I would like to parallelize this. In the following code, what's the difference between ProcessWithAnsycDelegates() and ProcessWithThreadPool()? public class ResultNotification { public EventHandler event Success; ...

How can I set different Tooltip text for each item in a listbox?

I have a listbox that is databound to a Collection of objects. The listbox is configured to display an identifier property of each object. I would like to show a tooltip with information specific to the item within the listbox that is being hovered over rather than one tooltip for the listbox as a whole. I am working within WinForms a...

[C#] Settings.Default.<property> always returns default value instead of value in persistant storage (XML file)

I recently wrote a DLL in C# (.Net 2.0) which contains a class that requires an IP address. A co-worker of mine altered the class to retrieve the IP from a ".dll.config" (XML) file -- This apparently is automatically generated by the "Application Settings" file he created (Settings1.settings). The benefit of this was to allow the end-use...

.NET Dynamic Objects with Reflection

How do I determine if a Nullable(of Enum) is indeed an Enum by means of reflection? I'm working with a method that dynamically populates an object of type T with an IDataReader retrieved from a database call. At its essence, it loops through the datareader's ordinals, and all the properties of T and populates the properties that match ...

How come I can't see member 'Default' on a class derived from ApplicationSettingsBase?

I'm using .NET 3.5 and I have a class, A, marked as internal sealed partial and it derives from System.Configuration.ApplicationSettingsBase. I then use an instance of this class in the following manner: A A_Instance = new A(); A_Instance.Default.Save(); Why would the Visual C# compiler be complaining: error CS0117: 'A' does not cont...