.net

Using a different type for a collection when serializing with WCF

Imagine I've got a data object that makes sense in an OO model, but for serialization I want to have its fields referencing other types replaced with simply an ID, or in some cases, a simple object with a text and an ID. Is it possible to have the serializer to handle specific fields differently, or do I have to redefine a second data o...

Generating classes using XSD without base class in each one

Not sure what the appropriate tags are here... A while back I created a batch script which, when run will convert all .xsd files found in C:\api\ into C# classes using the xsd.exe file found in the Microsoft Windows SDK (using v6.1 here). @ECHO OFF CLS ECHO *** ECHO Runs xsd.exe on all *.xsd files sorted by filename in the current fold...

.NET Framework built-in interfaces, recommendations when building a custom data structure?

I'm implementing an AVL binary tree data structure in C# .NET 2.0 (possibly moving to 3.5). I've got it to the point where it is passing my initial unit tests without needing to implement any framework level interfaces. But now, just looking through the FCL I see a whole bunch of interfaces, both non-generic and generic that I could...

How to by pass network using WebProxy?

If I want to bypass a Network like 192.168.1.0/24 using webProxy is there any way? WebProxy proxy = new WebProxy(); proxy.ByPassList = ??? ...

WPF: Keeping an object running?

I'm having problems understanding how WPF app.xaml works. Is it like Main method in winforms programing? What I want is a MainController class which keeps track of my Window object. For example: public MainController() { _windowMain = new WindowMain(this); } public WindowMain GetWindowMain { get { _windowMain; } } And so on with...

Log4Net logging IP address of a single session accross several threads

Please refer to: http://stackoverflow.com/questions/1340643/how-to-enable-ip-address-logging-with-log4net which explains how to log an IP using log4net. My problem is that in certain cases extra threads are spawned that belong to a session. Now I need log4net to understand (or the thread) to be able to log with the correct IP. Current...

Processing XML without loading entire document in memory?

I'm looking for a .NET XPathNavigator that can read XML without loading the entire document in memory (which is what XPathDocument does). Is there a class that does this, or do I have to write my own? ...

.NET Json Serialization Circular Ref Error (Object involves structuremap vars)

I have a web method called from Jquery to display a hierarchical tree object. The return value is a List (Of T) , where T is hierarchical, a parent-child relationship. traversal will be from parent to child. 1) .Net automatically converts the return value from webmethod to JSON to send it back to js client. At that point it throws a ci...

Diagnosing WinForms Databinding problem

I'm learning Databinding from here http://www.akadia.com/services/dotnet_databinding.html I'm just updating the dataset and then updating the sql database using sqlDataAdaper.Update(); this.selectCommand = new SqlCommand(); this.selectCommand.CommandType = CommandType.Text; this.selectCommand.Connection = this.connection; ...

What is the preferred method for building web services in .Net?

I am confused as to what is the best method for building a web service in .net. Giving the fact that it needs to be highly scalable. Any suggestions? ...

How to create multiline textbox which shows apostrophe before each line

I want a multiline textbox which shows apostrophes before and after each line. So that the textbox looks like: " Hello this " " is a funny " " string test " Or for example: // This is // a muliline // comment. Edit: These special characters must be readonly and if the user copies text from the textbox these characters should not ...

Creating global variables in asp.net using C#

I was working on window appication previously where i used to create global variables using modules in vb.net, but i found that in C# there is no concept of modules. so how can i create global vaiables in C# ...

C# Equivalent of "My.Computer.Network.Ping"

Question says it all really, is there a C# answer to VB.NET's My.Computer.Network.Ping ? Cheers! ...

Is there a framework for allowing apps published on Codeplex to auto-update directly from Codeplex?

Endowing utility applications with "auto-update" capability seems like basic good manners these days. I'm thinking of apps like Reflector or Paint.NET, that proactively tell you "hey, there's a newer release available. Wanna download it?" Q: Does anyone know of a common framework that can be used by apps that come from Codeplex proj...

How can I synchronise column orders in two listviews?

I have two ListViews in my app, with an initially identical collection of columns. When the user reorders the columns in one, I want the columns in the other to be reordered. I have the following event handler on one of the views' ColumnReordered event, and the corresponding handler on the other: private volatile bool reorderingColumn...

How do I implement intellisense support for a custom DLR language in VS2008?

I have just started writing my first language for the .NET DLR. I would like to know if it is possible to extend Visual Studio 2008 IntelliSense to handle the syntax of a custom DLR language? EDIT: I have decided to bypass VS2008 and target VS2010 instead. See accepted answer for more information. ...

How to create Global variables, ASP.NET, global asax

I have some data layer classes that r to be used very frequently, Almost in whole site. I was working on window application previously and i used to create its object in module (vb.net) but now i m working in C# and on ASP.NET. Now i need to do same thing so that i need not create same object multiple times on every page. I want to use ...

.NET Framework: Argument type 'uint' is not CLS-compliant on P/Invoke

Hello! It is safe to ignore this warning? Argument type 'uint' is not CLS-compliant I'm developing a Compact Framework applicatin and I have a lot of P/Invoke and I have to use uint, ushort, etc. as parameter's types. I've used [CLSCompliantAttribute(false)] to avoid the warning messages but I don't know it is safe. Some help would ...

Mapping Generic Classes using NHibernate

I'm trying to do the following, but it's complaining that the "classes referenced by 'extends' were not found". I think I need to having a mapping for each concrete type of Component but I can't specify the Attributes.Class twice.. The code is as follows: [NHibernate.Mapping.Attributes.Class(Table = "Components", Abstract = true, N...

Compare images in C# .NET

Hi, I have a scanned image of a document which has multiple boxes which may or may not contain signatures. I am able to identify the boxes, but now I want to figure out which boxes contain signatures. I tried to compare the image with the reference blank box image. Ideally pixel match should do,but my images can be tilted by some angle,...