.net

Breakpoint Affecting ProcessCmdKey Processing of keyData

Can anyone explain why the check for Alt+Left Arrow key is triggered on a Alt+Right Arrow key press within the ProcessCmdKey method? When I originally coded this method, everything worked. I am beginning to question all my key handlers, but wanted to know if there was a good explaination or if I am missing something. All other key combin...

Simple form of Array class and Enum.GetValues()

I am working with the static method Enum.GetValues(typeof(SomeEnum)); This method works great when all you need to do is enumerate the values, but for some reason it returns a very simple form of the Array class. I am trying to find an easy way to turn it's return value into a more "normal" collection class like a regular array or Li...

Duplicate keys in App.Config does not throw exception

I discovered this by chance when I have a duplicate key/value pairs in my app.config file for a .NET 2.0 console app. To my surprise, it works and the app reads the latest pair. I was pulling my hair when trying to figure out why I could not fetch the correct value of a key (cause I did not realise a similar key with an old value was low...

Null out parameters in C#?

Hi After reading on stackoverflow that in the case of checking the format of a DateTime you should use DateTime.TryParse. After trying some regex expressions they seem to get long and nasty looking to cover lots of the formatting. But TryParse requires an "out" parameter and since I just want to do a validation format check I don't nee...

How to add an existing Xml string into a XElement

How to add an existing Xml string into a XElement? This code var doc = new XDocument( new XElement("results", "<result>...</result>") ); of course produces this <results>&lt;result&gt;&lt;/result&gt;</results> but I need this <results><result>...</result></results> Any ideas? ...

Windows Process and Ip Address that it's connected to.

I'm trying to get the ipaddress that a process is connected to in c#. Is there an easy way to do this? ...

best c# open source tool for handling exceptions.

Can someone point me to a list of open source projects dedicated to exceptions handling ? Or to the best tool among them ? Update: I would like to use it with a n tier winform application. I would like to catch once and for all the 3 or 4 kind of exceptions that occur in my data access stack. Then pass them to the gui stack and show th...

displaying enumeration values in a DataGridComboBox problem

Hi. I have a dll that has a class called Series. This class has a field which is an enumeration of DataTypes. I am binding the datagrid to a list of objects of this class, and I am able to display the enumeration values in a combobox fashion However, the values' names don't make a lot of sense. For example, I want to display 'prc' as 'pr...

Which is the fastest search technique/method? (In context of file searching)

I don't know what they use in normal windows searching.But there is a technique in which you use indexing of files at once and then use the index later for faster searching.(e.g. Windows search 4.0) Is there any other way for faster searching than this? Can you elaborate from implementation point of view? (Assuming that I may need to im...

Enums And WCF - Meaningful Error?

I'm trying to overcome a problem with WCF and enums, where I'm trying to pass an object from the server to the client (or another server), which contains an enum. The enum starts with 1, on purpose. Everything goes fine when the enum is initialized and when the value is defined in it, but when it's not defined in the enum, I get this won...

Listening to HTML Events from BHO

I've been working on a BHO/toolbar written in C# that listens to HTML events raised on the browser's current webpage. The solution includes a reusable class called HtmlPageEventManager whose purpose is to subscribe to a given list of HTML events for each new webpage that's opened. A goal is to attach handlers as soon as the user can be...

XElement vs Dcitionary

Hi All, I need advice. I have application that imports 10,000 rows containing name & address from a text file into XElements that are subsequently added to a synchronized queue. When the import is complete the app spawns worker threads that process the XElements by deenqueuing them, making a database call, inserting the database output ...

How many methods can a C# class have

Is there a limitation on number of properties, methods a C# class can have? I do a quick skim at Standard ECMA-334 and did not find any information on it. Before jumping into why a class with many methods are bad design, I want to be more clear on the intention. Of course I will not be writing a class with large number of methods manua...

TcpListener.AcceptTcpClient and Firewall

I have a TcpListener object that is operating behind a firewall on port 4000. Obviously, in order for outside clients to connect to the TcpListener, port 4000 needs to be opened in the firewall; otherwise, no outside connection request would get through. My question has to do with what happens when I accept the connection request like ...

C# Circular Dependency Problem Solving Technique

While dividing my C# application in layers, I have solved the problem of circular dependency among layers in the following way: using System; using System.Collections.Generic; using System.Text; using SolvingCircularDependency.Common; using SolvingCircularDependency.DA; namespace SolvingCircularDependency.BO { public class MyClass...

C# - do you need to shorten lookup chains, like in JavaScript?

I have a class that has a public property. In a single function I refer to this property around 30-40 times. this.MyProp; Would it be better to define a local variable in the function?, string myProp = this.MyProp; After doing this - in the function I've shortened the lookup chains... so I only have to refer to myProp, rather t...

Using Linq in an object that only has GetEnumerator

Hello, you can use LINQ in an object that exposes only Add(),Remove(),Count(),Item() and GetEnumerator () from System.Collections.IEnumerator? Thanks in advance. Bye. ...

Why do I need the this. qualifier to use an extension method in a master page?

I have the following line of code in some master page code behind, but it fails without the this. Why is that? Repeater rep = this.FindControlsByIdRegEx("maintTableRepeater")[0] as Repeater; This is in the master page Load event, and the extension method is defined as; public static List<Control> FindControlsByIdRegEx(this C...

What Amazon S3 .NET Library is most useful and efficient?

There are two main open source .net Amazon S3 libraries. Three Sharp LitS3 I am currently using LitS3 in our MVC demo project, but there is some criticism about it. Has anyone here used both libraries so they can give an objective point of view. Below some sample calls using LitS3: On demo controller: private S3Service s3 = n...

Unable to Get data from DA layer. What to do?

While dividing my C# application in layers, I have solved the problem of circular dependency among layers in the following way: using System; using System.Collections.Generic; using System.Text; using SolvingCircularDependency.Common; using SolvingCircularDependency.DA; namespace SolvingCircularDependency.BO { public class MyClass...