.net

Programmatically create shortcut keys combo for desktop "shortcut"

Is there a way through code, or through the creation of a setup project (via VS), to create a desktop shortcut with a keyboard shortcut pre-defined? ...

How can I write my own LINQ provider to query some custom store?

I am planning to write a LINQ provider, so that I can query data in a custom store - for example, let us say, some custom file format. What is a good way to start? Any examples? ...

is logging an exception on the code of the Exceptions base class a good design approach?

some friends just finished the implementation of an app and they use Custom Exceptions. something that took my attention is that when a custom exception was raised they logged the exception in the code of the exception base class they implemented. so my question will be is this a good design approach?. my thinking is that a logging helpe...

C# Common Library.

Hello and thanks for any assistance. I'm hoping to find an open source .net common library, but I'm having a hard time finding one. What I'm looking for a is something that contains : Logging, Caching, String Manipulation, Config Reading, ext?!?. Do you know if anything like this exists or is this more likely something that I will ...

When and when-not to install into the GAC?

When should you install into the GAC and when should you not? (I am referring, really, to installing on a client's machine when they have purchased our product(s)). I have an assembly that is only going to be used with my one application (GAC or no-GAC)? I have an assembly that all my applications share (GAC or no-GAC)? All my applicat...

What constitutes 'redundant delegate creation'?

I was registering to an event in my class, and as per usual I was lazy and just use the autocomplete feature built into Visual Studio 2008 Pro which auto creates the delegate creation and it's associated method. public abstract class FooBase { protected event EventHandler<MyValueChangedArgs> MyValueChanged; protected FooBase() ...

How can compiling my application for 64-bit make it faster or better?

I use C#, .NET, VS.NET 2008. Besides being able to address more memory, what are the advantages to compiling my application to 64-bit? Is it going to be faster or smaller? Why? Does it make it more compatible with a x64 system (when compared to a 32-bit application)? ...

How to detect if my application is running in a virtual machine?

How can I detect (.NET or Win32) if my application is running in a virtual machine? ...

How do I use IoC in a setup like this? Is there a better way to test this?

I'm building a blog engine to test some concepts such us TDD and using inversion of control... I came up with a setup where I'd have a generic IBlogRepository interface so I could support both SQL and XML. public interface IBlogRepository : IRepository { Post GetPostById(Guid postId); Post GetPostByFriendlyUrl(string friendlyUrl); L...

What's wrong with this linq expression?

List<PageInfo> subPages = new List<PageInfo>(); // ... // some code to populate subPages here... // ... List<Guid> subPageGuids = new List<Guid> {from x in subPages select x.Id}; //doesn't work PageInfo has an Id field which is of type Guid. So x.Id is a System.Guid. 2nd line of code above does not work...I get two errors: The best ...

LINQ - Is it possible with dynamic LINQ to dynamically specify the from clause?

Hi I want to build dynamic linq. But I want to dynamically set the table (from clause) Is this possible? Malcolm ...

XAML - What's the point of (typing) it?

I am currently looking into learning WPF and Silverlight. So far I have been developing in Delphi and C# (Winforms). While looking at some books about WPF and watching some introductory videos online, I am getting the impression that this XAML thing is quite a step backwards in terms of efficiency and usability (for the developer). Espec...

Encoding problem using SQLite and WinForms 2.0 C#

Hello all I am developing a WinForms app using .NET 2.0 and am trying to use SQLite as a DB solution. My main problem is that I have trouble seeing data from the DB in the WinForm when the data is in a non english language (in my case greek). For db administration purposes I use the SQLite administrator which has no trouble at all retu...

.Net: Is String.Contains() faster than String.IndexOf()?

I have a string buffer of about 2000 characters and need to check the buffer if it contains a specific string. Will do the check in a ASP.NET 2.0 webapp for every webrequest. Does anyone know if the String.Contains method performs better than String.IndexOf method? // 2000 characters in s1, search token in s2 string s1 = "Many ...

Serialising state that is NOT exposed as a property

I have a problem with serialisation. The class in question represents a network packet and has an associated byte array for payload, which may be null. I exposed this using GetData and SetData methods in line with Microsoft Framework Design Guidelines recommendations, because in order to prevent bizarre crosstalk, reading and writing th...

.NET: Looking for best performing appender of log4net

We are currently using the log4net appender (web.config snippet): <appender name="FileAppender" type="log4net.Appender.RollingFileAppender"> Looking for experience using other appenders. ...

LINQ to SQL - Update to increment a non-primary-key field - thread-safe

I have two tables (well, two relevant for this question) : Bets (holds the bets; Columns : Id, , MessagesPosted, ) Bets_Messages (holds the bets' forum messages; Columns : Id, BetId, ) When I insert a new BetMessage in Bets_Messages I want to update (increment to be precise) the corresponding field in Bets. In pure T-SQL that would be...

How to delay loading aproperty with linq to sql external mapping?

I have a table that contains some blob fields that I don't want to load by default. In a dbml file it is possible to set the delay loaded property for such fields. Is there a similar option for external mapping files? ...

Best way to add a key/value to an existing URL string?

I want to generate a link on my page where a key/value pair is added to the URL dynamically so that: Default.aspx?key1=value1 Becomes: Default.aspx?key1=value1&key2=value2 So that the existing query retains any keys in the URL. Also, if there are no keys, then my key would be added, along with the '?' since it would be needed...

How do make modal dialog in WPF?

I am writing my first application in WPF and want to have the user input some data on a modal dialog window. Apparently, this is not simple to do in WPF, because the parent window stays fully enabled, and the method that created the new child window doesn't stop and wait for the child window to call Close(). Instead it just keeps going...