.net

Create a hashcode of two numbers

I am trying to create a quick hashcode function for a complex number class (a + bi) in C#. I have seen repeatedly the a.GetHashcode()^b.GetHashCode() method. But this will give the same hashcode for (a,b) and (b,a). Are there any standard algorithm to do this and are there any functions in the .Net framework to help? ...

.net OutOfMemory exception

While making some final tests of a class-library that I'm writing for Windows Mobile (using Compact Net Framework 2.0), I ran into an OOM-exception. Basically, my library loads first a dictionary-file (an ordinary text file with a word list) and thereafter another file based upon the dictionary (I call it KeyMap) which size is more or ...

Are there any issues with Isolated storage and Vista?

My problem is similar but not the same as that exhibited in: “Could not find file” when using isolated storage I've written an application that saves user settings in a file in isolated storage, I'm using the user store for assembly storage. The application checks for a file in isolated storage on startup and if it's not there as...

Purpose of the 64 bit public key token in .NET Assembly?

What is the purpose of the 64 bit public key token in .NET Assembly. I understand that the public key corresponding to the private key which is used to sign the assembly is embedded in the assembly itself. What purpose does the 64 bit public key token serve when the public key as a whole is available? ...

Perform single selection with where

I'd like to achieve the following SQL statement with subsonic 2.2 SELECT Product.* FROM Product WHERE Product.OurPrice <> Product.RetailPrice The Subsonic select query I've started with: SubSonic.SqlQuery select = new SubSonic.Select() .From<Product>() .Where(Product.Columns.OurPrice) .IsNotEqualTo(... object /*Should be Product.Co...

Is there a concise list of .NET 3.0 to 4.0 BCL deltas?

Does anybody know of or have a detailed list of how the BCL in .NET 4.0 has changed from 3.0? In other words, what types have been added or deprecated (or how have they changed)? All I have been able to find is the list of new features, such as the Wikipedia article, any of the endless MSDN blogs entries about it, or some questions her...

Using Indexable Properties in c#

I want to define some properties on a class using the [Indexable()] attribute in order to use the class with the i4o library (http://www.codeplex.com/i4o) but when I try and compile the code Visual Studio says it cannot find the Namespace for Indexable. Is this part of the CLR and which namespace/library do I need to get this to compile...

stop the execution in wcf request

i'm trying to reply a wcf request in 'AfterReceiveRequest' method of message inspector (implements IDispatchMessageInspector) XmlReader xmlReader = XmlReader.Create( new StringReader(string.Format(@"<{0}Response xmlns='{1}' />",methodName,namespace))); Message replyMsg = Message.CreateMessage(request.Version, request.Headers.Ac...

.NET Serialization Problem with Referencing a Static Field

I'm using SerializableAttribute to write an object jack to disk. The object has a member department which references a static field accounts of another class Department. On deserializing, I find that the member department of the deserialized object no longer points to the same object as the static field accounts but now points to another...

.Net implementation of DHT

Are there any open-source .Net implementations of distributed hash tables such as Chord, Pastry, Tapestry? ...

Single assembly from multiple projects

In a .net application involving several projects in one solution, I have a project with the namespace set to Company.Product.UI and another one with Company.Product.UI.WebPages. My problem is that two dlls result from building the two projects. How can I have a single dll and still preserve the current solution structure. I use Visual St...

Get Modem Info in .Net Compact Framework

I am using .Net Compact Framework on a Windows Mobile 6 environment and I need to get a list of modems and the serial port that they're attached to. In the full .Net Framework it can be easily done using System.Management.ManagementObject class; but, unfortunately this is not available in .NET Compact Framework and I haven't found any o...

Suppress compiler warnings using aspnet_compiler at the command line

Is there a switch to suppress specific compiler warnings when using the aspnet_compiler.exe warnings at the command line? I've tried fixing the errors myself, rather than ignoring them - they are for events that are defined by never used. I simply commented out the events, but this caused other problems! It's as if they are used but the...

Same asp:GridView in different ajaxToolkit:TabPanel

I have to filter GridView data based on the Tab Panel selected, Here is the scenario: I have the following tabs All | Tab A | Tab B | Tab C When I click on "All" tab, I get 10 records and my GridView contains 10 records, But when I click on Tab A, my GridView need to filter and show 5 records Right now, I am using the separate GridVi...

Wifi Sniffer App Guidance

I am writing a WiFi connectivity/sniffer in .Net to be used as a self deploying tool from a USB stick. The intention is that it will scan for unsecured available networks and then try to connect to each one in turn and detmerine whether there is a login / proxy or whether directo connection to my arbitary website is possible. This is to ...

Strange exception coming out of OdbcConnection.Open()

Bashing our heads against the wall here We are an ISV and have hundreds of companies using our software with no problems. The software is Winforms/C# on .NET 2.0. One of our clients has installed our software and it crashes on startup on all of their machines, apart from on one guy's laptop where it works fine. On calling OdbcConnecti...

Determine Whether Program is the Active Window in .NET

I have a C#/.NET app and I want to implement the following behavior: I have a popup menu. Whenever the user clicks on anything within the application that is not the popup menu, I want the popup menu to close. However, whenever a user is not in the application I don't want anything to happen. I'm trying to manage this through the Los...

Capture .Net Thread End Event

I would like an elegant way to capture a thread end/exit event. I've found two approaches so far: Use background worker, which has a RunWorkerCompleted event, or, Have my thread worker explicitly call an "I'm Exiting" delegate. Yes, these will work, but there must be some way from the parent thread (the thread that calls the Thread.S...

Is there a way to supply a default MessageTemplateResourceType to a Validator?

I have a class with lots of string properties that need validated. I'm using the Validation Application Block because I'm a big fan of using attributes to solve this kind of need. Everything works great but my manager isn't a fan of the amount of code needed in implementing the Message Template Tokens and resource file. For example: ...

Exporting X.509 certificate WITHOUT private key (.NET C#)

Hi everyone, I thought this would be straightforward but apparently it isn't. I have a certificate installed that has a private key, exportable, and I want to programmatically export it with the public key ONLY. In other words, I want a result equivalent to selecting "Do not export the private key" when exporting through certmgr and e...