.net

Is there native .NET type for CIDR subnets?

It's simple enough to code up a class to store/validate something like 192.168.0.0/16, but I was curious if a native type for this already existed in .NET? I would imagine it would work a lot like IPAddress: CIDR subnet = CIDR.Parse("192.168.0.0/16"); Basically it just needs to make sure you're working with an IPv4 or IPv6 address an...

Why does C# XmlDocument.LoadXml(string) fail when an XML header is included?

body = "<?xml version="1.0" encoding="utf-16"?><Report> ......" XmlDocument bodyDoc = new XmlDocument(); bodyDoc.LoadXml(body); This fails with an XmlException "Data at the root level is invalid. Line 1, position 1." Any ideas? ...

Batch Updates using DataAdapter

I have a situation where I have a bunch of SQL Update commands that all need to be executed. I know that DataSets can do batch updates, but the only way I've been able to accomplish it is to load the whole table into a dataset first. What if I want to only update a subset of the records in a table? ...

What is the best alternative IDE to Visual Studio 2008

Hi guys, At home and work I use VS2008. As I've only ever used Visual Studio for .NET development, I would like to expand my horizons and see what else there is on offer as an alternative to it. So what in your opinion is the best alternative to Visual Studio? Is there a viable alternative? ...

WPF Tab View, Custom Templates, and Accessibility

I'm having a problem with the WPF Tab View control that I was hoping someone here might be able to help me with. I want my tab view control to use rounded corners for the tab headers, because I think rounded tabs look better. To do this I modified the default control template for the tab by using the "Edit Copy" command in Expression B...

WPF Binding Collection To ComboBox and Selecting an item

I've been knocking my head against this for some time now. I'm not really sure why it isn't working. I'm still pretty new to this whole WPF business. Here's my XAML for the combobox <ComboBox Width="200" SelectedValuePath="Type.FullName" SelectedItem="{Binding Path=Type}" Name="cmoBox" > </ComboBox> Here's what populates the ...

DataRollBack with XtUnit in Nunit

Today I ran XtUnit at a part of my unit testing framework to to rollback database changes created while running a test case. This is a skeleton of how I have used it. The Test case ran successfully but the database state changed as a result. using NUnit.Framework; using TeamAgile.ApplicationBlocks.Interception; using TeamAgile.Applica...

How do I select top 10 rows in a table without sorting?

I want to select the top 10 records from a table in SQL Server without arranging the table in ascending or descending order. ...

A .NET type for describing 3D position?

I need a type which can contain a position of an object in a 3D environment - my house. I need to know the floor it is on, and the x and Y coordinates on that floor. The System.Windows.Point(int, int) only represent a two-dimensional space, but does .NET have a type for three-dimensional space? I realize that I could do something like...

Why doesn't the corflags utility warn when marking x64 assemblies as x86?

If I set the platform flags of MyApp.exe to be x64 I still can run the corflags utilty like this: corflags /32bit+ MyApp.exe corflags will happily set the 32bit flag to 1. Of course when I'll try to run the application I'll get an error: 0xC000007B = STATUS_INVALID_IMAGE_FORMAT My question is: Is there a way that an assembly which...

Open Source Proxy Library for .Net

I'm looking for a open source .Net HTTP proxy library. Basically I want to develop something like Fiddler (so much lighter with less features). ...

CollectionBase vs generics

migrating an app from 1.1 to 2.0. should i remove all uses of collectionbase.. if so what is the best strategy for migration. ...

Config files for assemblies in GAC

I have a .NET dll which needs to read it's config settings from it's config file. Usually, the config file is placed in the same directory as the DLL. But how do i read the config file if the DLL is GAC'ed, because I can put only the DLLs in the GAC, and not it's config files. ...

generics and interfaces enumeration

If have a set of classes that all implement an interface. interface IMyinterface<T> { int foo(T Bar); } I want to shove them all in a list and enumerate through them. List<IMyinterface> list foreach(IMyinterface in list) // etc... but the compiler wants to know what T is. Can I do this? How can I overcome this issue? ...

NHibernate Inheritance mapping when sub class in Separate Assemblly

Hi, Assume that core project have a base entity and every plugin maybe extend the base entity Solution structure : Application.Core.BaseClass Application.Module.SubClass (it's plug in, maybe not available) Is any way to implement this mapping with nhibernate subclass? Thanks and sorry for my bad english ...

.NET xml docs - inheriting documentation

NDoc has an XML element inheritdoc which allows you to inherit documentation of a member from the parent class (or an implemented interface). However, Visual Studio (i.e. the C# compiler) does not understand this tag and complains about the documentation not being present or complete. So does StyleCop and some other tools. Is there an al...

Why does .NET use banker's rounding as default?

According to the documentation, the decimal.Round method uses a round-to-even algorithm which is not common for most applications. So I always end up writing a custom function to do the more natural round-half-up algorithm: public static decimal RoundHalfUp(this decimal d, int decimals) { if (decimals < 0) { throw new Ar...

What are the most popular C# open source projects?

Most popular open source projects seem to use C or C++. I'm looking for a widely used and complex open source project that uses C#. Any suggestions? My preference would be for projects that are developer tools. ...

Schema (XSD) for Microsoft .NET configuration file

I'm searching the XSD (XML Schema) for the Microsoft .NET application configuration files. Till now I found only this: Configuration File Schema for the .NET Framework but I'm more interested in the XSD. Or - asked in general - I search also XSDs in general for .NET configuration files listed here. I've Visual Studio 2008 and don't see...

AS400 C#.net inserting new record problems

I am trying to build a C#.net program that works like a RPG Subfile on the AS400. Have the general subfile part working. I can display and then edit and update existing records. Am blowing up in my code where I am trying to insert a new record. Blowing up on the cmd.ExecuteNonQuery(); If you want to see how this works without the i...