.net

in Spring.config, can I define object of type string?

Can I do something like this: <object id="mydb" type="string"> <value>"blah"</value> <-- note that <value> tag does not really exist </object> So that I could use it later like so: <object id="Someobject" type="Sometype"> <property name="ConnectionString" ref="mydb"/> </object> EDIT: this was SpringFramework.NET sol...

Instance vs Static methods for multiple variable methods

If you have a Point3 class and have a method called Distance, should you have it static like this: Point3.Distance ( p1, p2 ); or an instance method like: this.Distance ( p ); I realize using static methods hinders inheritance and overriding, right? Which one is better, and why? ...

Changing values in place instead of creating new instances

Basically I have checked out xna and some of slimdx (Promit :)), which has lots of structs. Pretty much all methods that looked like this: public static Vector3 operator + ( Vector3 a, Vector3 b ) where doing stuff like: Vector3 c = new Vector3 ( ... ) I am wondering if it makes sense to just do: a.X += b.X ... return a Obvious...

Adding Web Service Reference to Apache Tomcat Fails In .NET 2008 (C#) App

I've been trying to add a web reference to a webservice located on an Apache Tomcat web server but I always receive an "HTTP status 503: Service Unavailable". I've been told that the problem is that Tomcat doesn't allow 2 HTTP parameters when requesting the wsdl. The URL I'm trying to retrieve the wsdl looks like: http://208.35.164.35...

How does the CLR actually map our abstractions into memory?

One thing that really interests me that I don’t see much written about or discussed in .NET circles is how the runtime takes our abstractions and implements them via the CLR. While there are a few books out there that discuss some of these issues (i.e. Richter’s CLR via C# or the very tragically ignored Advanced .NET Programming by Simon...

Keep Window Inactive In Appearance Even When Activated

Is there a way to keep a window inactive looking, even if it contains focus? I have two forms (A and B). After the user interacts with A, I transfer focus back to B. The result of the focus transfers (the user clicking on the A, then focus being transferred back to B) is that form A blinks from active to inactive. This looks ugly (es...

WinForms - Baffled - How to Handle Certain Controls Dynamically - Properly

I have a System.Windows.Form class (my main class). There is a RootMenu object. This is my own custom object. I'm trying to loop through the RootMenu object and on each pass add a ToolStripMenuItem to a ContextMenuStrip (which I named ContextMenu). The RootMenu object contains a List. Links have Names and Urls (both strings). When the f...

Native menu in C#

What is the best method of using native menus in C#? Edit: I want to use the native menu because it's better looking than the ugly .NET menu. Can someone explain to me exactly how I can use it? ...

Using .Net framework 3.5 features in .Net framework 2.0

Hello, Is it possible to convert some of the dlls of .Net framework 3.5 and use it in .Net framework 2.0? I really need the managed named pipes namespace in .Net 2.0 :-( Thanks ...

Is there any way of denying .NET controls to style the final HTML element

I have a control that look something like this: <asp:DetailsView ID="dvUsers" runat="server" DataSourceID="odsData" DataKeyNames="Id"> ... </asp:DetailsView> Which in the end will create a <table> as the outer-most element. In my CSS I have: table tr { border-top: 0 ; border-left: 0 ; border-right: 0 ; border-bottom...

How to set a checkbox to "checked" using mshtml?

Hi, I can do most things I need to with mshtml, but I'm a bit stuck with how to set a checkbox input element to "checked". Here's the situation... IHTMLElementCollection inputElements = (IHTMLElementCollection)doc.all.tags("input"); foreach (IHTMLElement el in inputElements) { string elementHtml = el.outerHTML; string termsOfSe...

Difference between Convert.ToInt32(string) and Int32.Parse?

Exact duplicate: http://stackoverflow.com/questions/18465/net-parse-verses-convert can anyone help me? ...

How to troubleshoot .NET 2.0 Error Reporting messages in the event log?

I work on an open source product called EVEMon written in C# targeting the .NET 2.0 platform, I have one user who is suffering from a strange .NET crash that we have been unable to resolve. Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: 4/29/2009 Time: 10:58:10 PM User: N/A Co...

C# - Adding Button inside ListBox

Hello there. I'm writing an C# App (WinForm) with a ListBox having content added by the user. Now, I could have a ordinary button under the ListBox to remove items, but I would like to have the button right next to the content, thus being inside of the ListBox. Like this: Content 1 | X Content 2 | X ... Content 5 | X The problem is ...

VSTO - Outlook event handler in C#

I have a need to display a custom form instead of the default inspector form for an outlook appointment item. I want to do this in C#. There's a good tutorial on devx but it's using VB, and I want to use C#. So I've translated the code to C# and I'm having a problem where I need to override the Open event handler for the AppointmentI...

A way to retrieve all strings from .net project?

Is there a way to list all strings (that are not embeddet in a ressource) in a .net project? I'm particulary interested in messagebox strings etc. so I can check if everything has been translated and written correctly. All tools I have tried so far can only list ressoure strings. Any help very appreciated. Ah forgot to say: I'm a Windo...

How do I ensure that objects are disposed of properly in .NET?

I have created a Windows Forms application in .NET 2 using C# that runs continuously. For most accounts I am pleased with it, but it has been reported to me that it has failed occasionally. I am able to monitor its performance for 50% of the time and I have never noticed a failure. At this point I am concerned that perhaps the program ...

C# difference between `==` and .Equals()

I have a condition in a silverlight application that comapres 2 strings, for some reason when I use '==' it returns false while .Equals() returns true. Here is the code : if (((ListBoxItem)lstBaseMenu.SelectedItem).Content.Equals("Energy Attack")) { // Execute code } if (((ListBoxItem)lstBaseMenu.SelectedItem).Content == "Energy At...

How does List<T> make IsReadOnly private when IsReadOnly is an interface member?

I'm creating a specialised proxy class that implements IList<T> and wraps an internal List<T> instance. List<T> itself implements IList<T>, which declares a member bool IsReadOnly, but when I try to access that member from my own class, I can't because in List<T>, IsReadOnly is private. So my question is; if an implementation of an int...

Why C# implements methods as non-virtual by default?

Unlike Java, why C# treats methods as non-virtual functions by default? Is it more likely to be a performance issue rather than other possible outcomes? I remind reading a paragraph from Anders Hejlsberg about the several advantages the existing architecture is bringing out. But, what about side effects? Is it really a good trade-off to...