.net

What makes the CLR show Assertions?

If I define the Debug constant for my C# Project in visual studio I can be sure that assertions will be evaluated and a messagebox is shown when they fail. But what flag, attribute makes the CLR at runtime actually decide whether a an assertion is evaluated and displayed. Does the assertion code not end up in the IL when DEBUG is define...

how to generate custom collection type in .Net from WSDL?

I am running a custom application that imports WSDLs and generates C# source code, using WSDLImporter class to read in contracts. XSD sequence types are translated into native arrays. What options can I set in order to be able to generate custom collection types? Schema: <xs:complexType name="getAllSourcesResponse"> <xs:sequence...

System.Windows.Forms.DataVisualization Namespace Fine in One Class but Not in Another

Hi. I'm getting this error The type or namespace name 'DataVisualization' does not exist in the namespace 'System.Windows.Forms' (are you missing an assembly reference?) Here is my using section of the class: using System; using System.Collections; using System.Collections.Generic; using System.Windows.Forms.DataVisualization.Charting...

Can I spawn a synchronous process in VB6 and retrieve its return value?

Is it possible to spawn a synchronous process in VB6 (i.e. calling an external .exe), wait for it to terminate, and grab the return value? We have legacy code (in VB6 obviously) that we need to call a .NET application to perform some complicated tasks, and based on the .NET app's return value, either proceed or fail. Is there a better ...

When are interfaces needed?

(In the context of .NET for what its worth) I tend to not use inheritance and rarely use interfaces. I came across someone who thinks interfaces are the best thing since spit. He uses them everywhere. I don't understand this and hence the questions that follow. I just want a check on my understanding of interfaces. If you are using...

Serialization byte array vs XML file

Hello, I am heavily using byte array to transfer objects, primitive data, over the network and back. I adapt java's approach, by having a type implement ISerializable, which contains two methods, as part of the interface, ReadObjectData and WriteObjectData. Any class using this interface, would write date into the byte array. Something...

Most robust Equals implementation for custom classes for value equality in C#

Say I have a Point2 class, and I want to implement the following Equals: public override bool Equals ( object obj ) public bool Equals ( Point2 obj ) This is from the Effective C# 3 book: public override bool Equals ( object obj ) { // STEP 1: Check for null if ( obj == null ) { return false; } // STEP 3: e...

Manually create unbound datagrid

Can anyone tell me if it is possible to create and add data to an unbound WPF Toolkit datagrid. If it is in fact possible to do, can someone please provide an example of the following: Programmatically: create a datagrid create a datagridtextcolumn add the datagridtextcolumn to the datagrid create a datagridrow set the text of the data...

Can JScript.NET distinguish different .NET exception types

I'm using JScript.NET to write scripts in a C# WinForms application I wrote. It works really well, but I just tried putting some exception handling in a script, and I can't figure out how to tell what type of exception was thrown from my C# code. Here's some example JScript code that throws two different types of CLR exception, and then...

.NET Large Object Heap and JSON interaction

I have an asp.net application that serializes data to the client using JSON. Once load reaches a certain level, the app is spending an in-ordinate time in GC and after spending some time with WinDbg/SOS and related tools it appears that there is a substantial amount of LOH fragmentation taking place because the size of the generated JSO...

INotifyPropertyChanged vs. DependencyProperty

I need to watch properties for changes. Which method is better in terms of performance and memory use: implementing INotifyPropertyChanged or using a DependencyProperty? Note: Yes, I have read the other question INotifyPropertyChanged vs. DependencyProperty in ViewModel. ...

Windows workflow type load exception

I am building a state machine with windows workflow, and I am trying to new up an object from another assembly in my solution. When I build the solution, I get a TypeLoadException from the StateActivityValidator (which runs after a successful build to see that all the required properties are set and such). The type I am trying to crea...

Where is the navigator panel in .net's visual studio ?

I'm used to the Netbeans environment, now I'm learning C# in Visual Studio, I can't seem to figure out where the navigator is in the VS setting, in NB it shows me the members of a class, I believe it must exist in VS, can someone point me in the right direction ? ...

What is the Keycode for % sign?

I am using C#.Net. I have textbox which allow only number, decimal and percentage(%) sign. I have the keycode for all number and decimal, but what is the "%" sign's keycode? How can I check the keydown event for %? ...

Does null inherit from Object as well in C#?

Does null inherit from Object as well in C#? Where does the null itself defined? ...

Accessing a UNC drive in ASP .NET?

I have two different sets of image files that reside in the root images directory of two different web sites on two different web servers. For arguments sake, let's say the first web server is called web1 and has a primary ip address of 111.111.111.111 and the second web server is called web2 and has a primary ip address of 111.111.111.1...

JQuery Ajax form submitting

Not exactly sure why this is happening, but upon click of a button I call a JQuery Ajax control, after that I do not want to continue submitting the form, but before the page gets still submitted. <asp:ImageButton id="btnContinue" OnClick="btnContinue_Click" runat="server" OnClientClick="return false;" /> and the jQuery: ...

C# service with Oracle .NET provider gets slower and slower

I have a C# service written for .NET 2.0 that uses the Oracle data access provider for .NET 2.102.2.20. The service runs multiple threads and runs lots of queries to an Oracle 9.2 database. I am using NHibernate. What I am seeing is that when it starts up it runs fast, then gets slower and slower. The CPU usage starts low then goes up a...

How do I read an excel file in c# without missing any columns?

I've been using an OleDb connection to read excel files successfully for quite a while now, but I've run across a problem. I've got someone who is trying to upload an Excel spreadsheet with nothing in the first column and when I try to read the file, it doesn't recognize that column. I'm currently using the following OleDb connection s...

How to select all text in Winforms NumericUpDown upon tab in?

When the user tabs into my NumericUpDown I would like all text to be selected. Is this possible? ...