.net

Can I reuse a Transaction? and how?

I must use a corporate class that re-uses or re-creates a transaction after every Commit() or Rollback(). This class is told to use (or not use) transactions via a Boolean ctor parameter. I am thinking of wrapping this API to separate the transaction support (to rely explicitly on Transaction objects or the ambient TransactionScope). Bu...

How to Share App.config ?

How can I share/link App.config or Web.config between multiple projects in a visual studio solution ? ...

Is this a bad practice to catch a non-specific exception such as System.Exception? Why?

I am currently doing a code review and the following code made me jump. I see multiple issues with this code. Do you agree with me? If so, how do I explain to my colleague that this is wrong (stubborn type...)? Catch a generic exception (Exception ex) The use of "if (ex is something)" instead of having another catch block We eat SoapEx...

How much memory does a C#/.NET object use?

I'm developing an application which currently have hundreds of objects created. Is it possible to determine (or approximate) the memory allocated by an object (class instance)? ...

What is the best way to call a .net webservice using jquery?

I'd like to call a .net webservice from another domain using only jquery. What is the best way to do this? and are there any configuration changes I need to be aware of on the web site hosting the web page? The reason I ask this, is that I am only marginally in control of that area. So I can only make limited changes. ...

How to speed up the initialization of a .net client application (winforms or wpf)?

Sometimes I create some quick personal projects using c# with windows forms or wpf. I have noticed that depending of the kind of application, looks that managed applications take 2x or 3x more time to start compared with native applications. It's does a "Quick Notes" application don't so... "quick". :-( There are some technique to spee...

.NET C# drawing slowly

Hi all, I have a problem drawing something quickly in .NET. I don't think that any thing in particular should take much time, but on every machine I've tried it on, I get serious issues. This is implemented in vs2008 .NET, using C# (with some stuff in C++, but nothing relevant to the drawing). I have three screens, and the user shou...

Nullable Enum nullable type question

I get the following compilation error with the following source code: Compilation Error: Type of conditional expression cannot be determined because there is no implicit conversion between '' and 'MyEnum' Source Code public enum MyEnum { Value1, Value2, Value3 } public class MyClass { public MyClass() {} public MyEnum? M...

How do you preserve message order when consuming messages from ActiveMQ?

I have a .NET service that uses the ActiveMQ client. I have implemented a MessageListener with a transacted connection to consume the messages. Occasionally, I get messages in a different order in which they were put onto the queue. Was it wrong to use a MessageListner? Is there a way to preserve the message order? FYI: There is one...

How do you kill a process for a particular user in .NET (C#)?

I work off of a multi-user Windows Server, and the rdpclip bug bites us all daily. We usually just open task manager and kill then restart rdpclip, but that's a pain in the butt. I wrote a powershell script for killing then restarting rdpclip, but no one's using it because it's a script (not to mention the execution policy is restricte...

Delay Signing on Compact Framework

I want to use delayed signing for my windows mobile compact framework assemblies. When you sign an assembly using delayed signing it signs it with the public key and leaves space in the assembly for the private keys, which can be added just before shipping the assembly. A delay signed assembly can not be run or debugged unless the sign...

F# + MPI + MONO : Clustered Computing

Is it possible for F# and MPI to run off of Mono on a linux computational cluster? Anyone able to attest to it's performance/reliability? ...

Does the User Interface Process (UIP) Application Block live up to its promises?

I'm working on a project that needs to produce an application that runs both as a stand-alone application and a web application. We're considering using the User Interface Process (UIP) Application Block that available on the Microsoft Patterns & Practices web site. The application block claims it can make this possible: This block...

Where to draw the line - is it possible to love LINQ too much?

I recently found LINQ and love it. I find lots of occasions where use of it is so much more expressive than the longhand version but a colleague passed a comment about me abusing this technology which now has me second guessing myself. It is my perspective that if a technology works efficiently and the code is elegant then why not use ...

How To Set Client Time Zone Equal to Server Time Zone Window App .Net C#

My Client Application Receives data through WebService from a Remote Server. The Application is basically written in 1.1 Framework Windows Form. All I want to do is to set my Client App TimeZone equal to Server TimeZone so that any Date Time related discrepancies can be avoided. For this I would like to know How to retrieve Server Time...

How to format a string of HTML programatically.

I've got unformatted html in a string. I am trying to format it nicely and output the formatted html back into a string. I've been trying to use The System.Web.UI.HtmlTextWriter to no avail: System.IO.StringWriter wString = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter wHtml = new System.Web.UI.HtmlTextWriter(wString); wH...

How Do I Get External LIbrary Like Html Agility To Work In My C# Project?

How do I use a free library, such as Html Agility in my Visual Studio Express C# programs? Obviously I have downloaded it. What I need to know is how do I set it up so I can simply use a "using" statement to link up with the classes. Html Agility does not come with any .dll's so do I need to compile it to dll, and then reference to th...

Why are many of the banking sites implemented in Java rather than .NET?

We are developing an application for a banking client which includes transactions and the site should be very secure. The business process is finalized. Then we decide on the technology. We suggested .NET 3.5 framework with C#. The client replied for security reasons and ease of use we are going to Java. Also many of the banking sites ...

How Can I Get C# To Distinguish Between Ambiguous Class Names

How can I get C# to distinguish between ambiguous class types without having to specify the full 'HtmlAgilityPack.HtmlDocument' name every time (it is ambiguous compared to 'Systems.Windows.Forms.HtmlDocument' Is there a way to make C# know that I am ALWAYS talking about one class or the other, and thus not have to specify each time I u...

DataSet.Locale what it does ?

Can someone plz tell me what's the Use of DataSet.Locale and can it be used to solve this issue. My Server is located in US and I am running a query against it. The Data contained in the table both at Remote Server(U.S) and Local are same. The Problem is when I am retrieving the DataSet using WebService from Remote Server. The Dates Co...