.net

Do I need to provide cast methods for cast operator overloads in C#, to allow people to use in VB

I read somewhere that older VB .net (pre VB .NET 2005?) couldn't use overloaded operators in a C# class. Is it true for overloaded cast operators? Either way do you guys think it's a disadvantage for a C# class library not to include them and arithmetic methods as actual methods for other languages, like: ToDouble ToFloat FromDouble Ad...

Any tips for improving Visual Studio 2008 ASP.NET designer performance?

It's been bugging me for a while now, but the ASP.NET designer in VS 2008 can be terribly slow for editing even the simplest of pages. The machines we use are not bleeding edge, but one would think that a 2Ghz Dual Core AMD 3800+ with 3Gb of RAM and a 7200RPM 120Gb hard drive would perform better than it does. To quantify the problem, ...

C# can't cast bool to int

We all know that in C# we can't cast bool to int. I wanted to see what is the binary representation of true with bitmask, but I can't use (bool & int).. I think the problem is the architecture desicion "true is true, not any number != 0" (C++) and I was wondering what the benefits of such an architecture are? What is so bad with the C tr...

How does one test generic collections in nunit?

How can I do something like this in NUnit? class Foo { int Value { get; set; } ... } ... ICollection<Foo> someFoos = GetSomeFoos(); Expect(List.Map(someFoos).Property("Value"), Has.Some.EqualTo(7)); List.Map() only accepts ICollection, not ICollection<T>. ...

Run Message Loop while waiting for WaitHandle

Is there any way to process all Windows messages while the UI thread is waiting on a WaitHandle or other threading primitive? I realize that it could create very messy reentrancy problems; I want to do it anyway. EDIT: The wait occurs in the middle of a complicated function that must run on the UI thread. Therefore, moving the wait to...

Sending raw xml to a web service

I'm trying to invoke a web service which I do not control. The web service expects XML for which I have the xsd. I want to send the raw xml to the web service, i.e. preventing the proxy from XML-encoding whatever I send. How can I do this? ...

RequiredFieldValidator not firing when ControlToValidate visiblity is changed

When I change ddl.Visible=true(it gets changed on partial postback/updatepanel from another form element event)the RequiredFieldValidator will not fire? NOTE: This is not a question on how to use the RequiredFieldValidator in a normal circumstance. My form has cascading dropdowns that are all dynamically built with their visibility tog...

Winform - which is a usercontrol last event to fire

Which is a usercontrol last event to fire when the application/control is loaded? The load event? ...

DataGridView, ADO.NET, Binding, and Paging on the Client

I'm working on a WinForm application that has several queries that bring back approx 20000 records and then fills a DataTable, and binds that DataTable to a DataGridView. I want to allow the users to page through the grid 500 records at a time. What is the best way to do this? I want to do the paging on the client side. I see that the S...

Image vs Bitmap class

Afternoon all, As this is my first post, let me introduce myself, I am Kadrin. I'm a developer at a large corporation in the central United States and have been out of college for about 1 year. Anyway, I've been reading up on my C# alot lately (my team is slowly moving over to C#) and am having troulbe understanding the differences b...

How to implement Slerp for a Point3?

I am trying to implement a Point3.Slerp method, so was looking for some samples but the ones I found seems like it's a whole brand new class to host all the code. Is there a simple, straightforward way to implement it? Basically the ones I have seen was using Matrix types. Can I implement Slerp without matrices, or would that be a disad...

Store Relational database as XML

I have to store relational data (text, numbers and pictures) into an XML file. I want to maintain the relationship between data and the tables structure. How do I go about doing that? My Windows Mobile application use Windows Communication Foundation (WCF) to get data. Once it gets the data it stores them into an XML file. The WCF use...

.NET WinForms HTML editor component

We're looking for a .NET component for HTML editing in WinForms. I've seen this post, and that's kind of what we're using now, but it's pretty old and crufty, I'm looking for a cleaner solution. I don't really have the time (or right now, the inclination) to write our own from scratch...and am hoping there's a commercial/free solution ou...

HttpWebRequest over SSL with client credentials

I'm trying to use HttpWebRequest to get an https URI that requires a username and password. If I put the URI into a browser it pops up a dialog asking for credentials and then works. Using HttpWebRequest gives me a 401 Unauthorized error. The documentation for NetworkCredentials says it doesn't support SSL, but I can't find what I'm sup...

PHP (or other linux friendly) equivalent to .Net System.Xml.Linq

I've been working with the xml.linq classes in .net recently. But may need to use a linux friendly language for an upcoming project. The things I like the most are Xdocument, being able to load from a file or parse from a string XElement, quickly creating a custom structure for page specific data Traversing Children, Parents, Sib...

WSE service update; "wse" suffix issue

I have an application that references a web service using WSE 3.0 (VS2k5 and .Net 2.0). The application, which is a third-party app, contains a reference to the proxy object "ThisServiceWse", when I update the web service reference the proxy object name is changed to "ThisService", without the "Wse" suffix. This implies that the projec...

Is Hibernate worse than NHibernate?

How does Hibernate compare to NHibernate? I've heard the claim that "Hibernate is much worse than NHibernate, even to the point of not using it (and using JDBC over it)". Can anyone support or refute this? Update - I am not trying to decide between them. Our DAL team decided to use NHibernate for our .Net side, but not use Hibernate on...

Essential "code toolset" for java/.Net

What essential code packages do you use on every project, that's not included in the BCL or java distribution? Mocking/Stubbing Unit Tests IOC / Dependency Injection Logging ORM ... Which implementation of the above do you use? What essentials did I miss? ...

Calling a windows form from another thread (.Net)

Hi I'm developing a .Net application and I want to achieve the following: I have a winforms application, and a timer (System.Timers.timer) that excecutes a thread based on a schedule. The problem is that I cannot access the UI (windows form) from the secondary thread (WorkerThread), the error say something like the component cannot be a...

What is the easiest way to add global keyboard shortcuts in Windows?

I would like for my app to detect keyboard shortcuts when it isn't running, but as there doesn't appear facility to do this in Windows a reasonable fallback would be to have a background process without any UI that listens for keypresses. Is it possible to monitor keypresses when an app isn't in the foreground in .Net? Looks like this ...