.net

Does HashSet preserve insertion order?

Does the HashSet collection introduced in .NET 3.5 preserve insertion order when iterated using foreach? The documentation states, that the collection is not sorted, but it doesn't say anything about insertion order. A pre-release BCL blog entry states that it is unordered, but this article states that it is designed to preserve insert...

Capturing datagrid cell header click

Hi, I just want to check if a click is made in an datagrid whether the click is made on a header r on a cell content. I am facing a problem when... when cell is clicked i am manipulating with the data. But if the header is clicked for sorting ,same cell click event is triggered. How can i stop this ? ...

How do you decide what assemblies to split your project into?

What's the most important consideration when deciding how to partition your application into assemblies? Do some people just create one assembly per unique namespace (or perhaps per root namespace) for convenience? Or one per app-layer (like Presentation, Business/Services, Data)? Or more subtle perhaps, put the entire Model in one assem...

Execute a statement after thread gets over.

Hi, I am having a function where I have used a thread in c#.net. I am having a another function on the next line of that thread. But this function has to be called only after the thread gets executed. How can i do it ? Example.. Somefunction() { // thread //(thread started) add() (another function but need ...

How to access the user font settings of the Internet Explorer?

I would like to access the Internet Explorer user settings for fonts, especially the font family, within a Browser Helper Object written in C#. I have looked into SHDocVw.WebBrowser and IHTMLDocument( to 5) but I don't see what I'm looking for or missing the property. The BHO is for Internet Explorer 7. Thank you very much! Edit: Ric...

How to handle a class you want to extend which is sealed in the .NET library?

I was reading somewhere about how to handle the issue of wanting to extend a sealed class in the .NET Framework library. This is often a common and useful task to do, so it got me thinking, in this case, what solutions are there? I believe there was a "method" demonstrated to extend a sealed class in the article I read, but I cannot rem...

SetCompatibleTextRenderingDefault in .NET Class Library containing a form

Hi I have a .net class library with a com class that calls a form. I want to to SetCompatibleTextRenderingDefault(false) to ensure the form fonts look nice. If I run the command in the class constructor I get the following error: SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the app...

Is there a .Net interface to Oracle SQLPLUS?

Hi, I'm developing some automation to control the execution of SQL scripts. The scripts are run through SQLPLUS and contain PL/SQL calls in them (hence I can't run them through ODP.NET). I was wondering if there was a .NET interface to SQLPLUS? If so has anyone used it? Cheers Rich ...

C#: Using event handlers vs overriding event-firing methods

I am creating a subclass of Button and would like to add custom functionality to some of its events such as OnClick. Which is the more desirable way to do it? Do I override OnClick: protected override void OnClick(EventArgs e) { base.OnClick(e); doStuff(); } or should I instead link up the OnClick event to an event handler d...

Running Oracle stored procs from C#

Hi, A beginner question: I have a stored proc (just a procedure, without any packages) in the Oracle Database: CREATE OR REPLACE procedure FII_DBO.CLEAR_UNIT_TEST_PRODUCT IS BEGIN ... END CLEAR_UNIT_TEST_PRODUCT; and it works fine in TOAD. However, when I try to run it from C# it complains: System.Data.OracleClient.OracleException...

Checking Download size before download

Hi I need some way to check the size of a download without having to download the entire file. I am using C# and the System.Net.WebClient to do the downloads.The check needs to run in a asp.net webservice. Thanks ...

Max TCP Connections to a machine

I am creating a Windows Service in .NET to which N number of client can connect. The service starts a TCP listener and accepts the client connections. The problem I am facing is that I can only open 10 connections to this service. The listener::AcceptTcpClient() method accepts only 10 connection and throws an exception for 11th one. The ...

Best practice for DLL calling an object in the EXE

I'm building a DLL with several "master" objects that need access to the app LINQ DataContext. The DLL will serve several projects with different dataContexts, so I need the DLL can call the object that it's inside the EXE. What is the best or elegant way to do it? Edit: Clarification Code example of what I'm trying to do: 'DLL '--- P...

Is there an attribute to mark the class or method to be thread safe in .NET?

In .NET how can I know if a class or method is thread safe or not? Is it by default not thread safe? ...

Can WebInvoke attributes be replaced by binding configurations

In order to get a WCF service working with JQuery I have added a WebInvoke attribute on the operation contract to control the JSON serialisation as follows: [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)] Is there a way to control this serialisation via the service bindings in ...

the best way to store tree like information in app.config

What would be the best way to store a tree like the one below in app.config and how would I deserialize this information from it? Tree |-node1- | |-name - value | |-name - value | | ...... |-node2- | |-name - value | |-name - value | | ...... |-node3- | |-name - value | |-name - value | ...

How to implement incremental search on a list

I want to implement incremental search on a list of strings. Consider I have an array containing which contains the strings store,state,stamp,crawl,crow. My application has a text box in which the user enters the search string. Now, as the user enters the text, I need to highlight all the matches. For example, when the user enters "st" I...

Where to put my siteLanguage parameter (cross cutting concern?)

In my project every page is translatable in several languages. For that purpose, I pass a sitelanguage parameter to each action. My custom base controller class catches this "siteLanguage" parameter and takes care of the further translation logic. This works allright, only thing is now I have to add a string called sitelanguage to every...

How can I determine my root calling assembly's version number at runtime? (.NET)

Example: MyProgram.exe is executed. It calls MyClassLibrary1.dll which calls MyClassLibrary2.dll. How can I determine from within MyClassLibrary2.dll what the assembly version of MyProgram.exe is? Is this possible? Thanks. ...

Is there a .NET version of Concordion?

Apart from Fitnesse is there anything like concordion for .NET? Concordion is an open source framework for Java that lets you turn a plain English description of a requirement into an automated test David Peterson (the author of Concordion) has told me that there is no .net port of Concordion that he knows of. However he say...