.net

How to get IDictionaryEnumerator from generic IDictionary?

I have a dictionary as follows: IDictionary<string, string> dict; How to create an enumerator that implements IDictionaryEnumerator (preferably using linq)? ...

CRUD Class Library Design, to return useful messages about business logic failure, that is not exceptional

I'm building a basic CRUD library, that I anticipate use in both local (add reference) and wcf (add service reference) environments. What are the best return types for the Create, Uupdate, and Delete portions (that have more complex business rules) of a CRUD setup? I want to be able to minimize back-and-forth on the wire, but I also wa...

Where are LINQ assemblies located in Windows XP?

Where are LINQ assemblies located in Windows XP? ...

How do I use arrayList.contains on my object

I have been trying to check my arraylist to see if an object already exsists, but it always returns false. Does any one have a sugestion to what I am doing wrong with the arrayList. ArrayList arr; void Init() { arr = new ArrayList(); } void Fred() { CauseAssignment ca = new CauseAssignment(Param1.Text, Param2.Text); if(...

How do I properly filter child objects?

I apologize for syntax errors, this is my simple explanation of the problem. I've setup my dbml file with a relationship between Customers and Orders on CustomerId. I'm trying to return all orders for a customer that are less than $10. Customer customer = context.Customers.FirstOrDefault(c => c.Id == 123); IEnumerable<Order> orders = c...

How does foreach work when looping through function results?

Suppose I have the following code: foreach(string str in someObj.GetMyStrings()) { // do some stuff } Will someObj.GetMyStrings() be called on every iteration of the loop? Would it be better to do the following instead: List<string> myStrings = someObj.GetMyStrings(); foreach(string str in myStrings) { // do some stuff } ? ...

Managed local storage for blobs

The general consensus these days seems to be that you do not store binary large objects in your relational database, as its not really optimised for that sort of thing, and instead put it into a dedicated storage engine. Can anyone suggest a solution for the .Net platform, along the lines of the Microsoft Azure Blob Storage engine, but ...

itextsharp and livecycle

i've managed to create a template (for an invoice) in livecycle. i've choosed dynamic pdf instead of static pdf because of a few fields that needed to autoresize (like address, product name). now i use itextsharp to complete the fields, and it works if i save the pdf as acrobat 7 dynamic xml form. the problem is that the fields are edit...

Weird problem : "Specified argument was out of the range of valid values."

Hi folks, I've got realy weird problem on a web page when processing a post back. Here is the error will fallow an explication : Error : Specified argument was out of the range of valid values. Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack tra...

.NET (C#) - How do you get XML comments to appear in a different project (dll)?

Consider: /// <summary> /// This method does something... /// </summary> public void DoSomething() { // code... } When using that method/class etc.. in a different dll the comments do not show up. I've tried a few things - any ideas? Thanks ...

HELP! How do I set the RichTextBox.SelectionFont FontFamily without changing the Style?

One of the controls in my application limits a user to be able to change only the font style (B, I, U) and colour of the text. I have created a custom control which inherits from the RichTextBox for this purpose. I am able to intercept CTRL-V, and set the font of the pasted text to SystemFonts.DefaultFont. The problem I am currently f...

Can I make an existing (fixed) class implement a new interface?

I have a feeling I already know the answer people are going to give, but here goes anyway: Say I'm writing a new class, let's call it PooledQueue<T>, in the constructor of which I want to accept an argument that implements the interface IResourcePool<T>. The idea here is that I'm fine with using any underlying pool object, as long as it...

Calculating the path relative to some root- the inverse of Path.Combine

Is there a reliable way to calculate the inverse of Path.Combine()? Path.Combine("c:\folder", "subdirectory\something.txt") might return something like "c:\folder\subdirectory\something.text". What I want is the inverse, a function where Path.GetRelativeUrl("c:\folder", "c:\folder\subdirectory\something.text") would return something li...

AnyOne Know of a Good Word Count Algorithm in C#

I am looking for a good word count class or function. When I copy and paste something from the internet and compare it with my custom word count algorithm and MS Word it is always off by a little more then 10%. I think that is too much . So do you guys know of an accurate word count algorithm in c#. ...

I can't load bitmaps on WinCE

I wrote a small project that displays icons on the screen on WinCE. The icons are 28x28 16-color BMP files, placed in the main resource file (Resources.resx) (the resx for the main Form has the same problem, and GIF files don't work either). The first time I try to get any bitmap from the resources, an exception of type Exception with M...

Good .NET Application Installer

Hi All, I have a windows application I want to create an install package for and am wondering what the best solution(s) are. I have used the free Setup Project that comes with Visual Studio but it doesnt seem to be the greatest when it comes to uninstalling or installing newer versions or requiring the .NET runtime or customizing the U...

Install Windows Service with Recovery action to Restart

I'm installing a Windows Service using the ServiceProcessInstaller and ServiceInstaller classes. I've used the ServiceProcessInstaller to set the start type, name, etc. But how do I set the recovery action to Restart? I know I can do it manually after the service is installed by going to the Services management console and changing the...

How to detect programmatically whether code is running in shared DLL or exe?

A have a C# class which simplifies the handling of global hot keys. This class uses the Win32-API function RegisterHotKey() to register the hot keys. According to MSDN this function needs an ID value in the range 0x0000 through 0xBFFF when calling from an application and an ID value in the range of 0xC000 through 0xFFFF when calling fro...

Detecting glyphs occurrences in any fonts

Hi, everyone. I'm writing a small .NET application that can produce SWF files, and I need to support Unicode fonts. I don't know the things on it and font rendering well, so I understand that I've made some blunders while writing my application: many fonts installed on my Windows don't support Unicode characters so I can see hollow squa...

An efficient solution to a String.Replace problem?

Say I have an array of Strings declared like this: String[] strings = new String[ 1024 ]; And given an array of key value pairs declared like this: KeyValuePair<String, String>[] pairs = new KeyValuePair<String, String>[ 50 ]; What are the possible workarounds for a solution that would do this: for ( int i = 0; i < 1024; ++i ) { ...