.net

Convert XHTML to XAML?

Good afternoon, does anyone know of a good xhtml to xaml converter library / functionality? All the ones I've found are far from complete, are missing elements of the base xhtml namespace (e.g. tables etc) and what I need is to display valid xhtml in an wpf flowdocument. Any ideas / suggestions? Cheers & thanks -Jörg ...

CategoryRouteHandler() reference

Here is the example I see everywhere for routing without mvc. public static void RegisterRoutes(RouteCollection routes) { routes.Add(new System.Web.Routing.Route ( "Category/{action}/{categoryName}" , new CategoryRouteHandler() )); } Problem: CategoryRouteHandler assemble can n...

Bidirectional Map in .NET

Is there a .NET data structure I could use for bidirectional lookup? Here's the problem: Serialization. My object contains a field which points to one of 10 predefined static objects. When writing to the file, I write a single character representing which of the 10 objects is being referenced. At this point, I need a lookup datastructur...

What exception should be thrown when validating results from external callbacks in .NET?

ArgumentException and ArgumentNullException are both used for validating arguments, eg. if (argument == null) throw new ArgumentNullException("argument must not be null", "argument"); What is the best equivalent for validating the results of callbacks, eg. var x = argument.GetX(); if (x == null) throw ??? ...

Generic Lookup Table Replacement

About five years ago I started using Generic lookup Tables for applications I was developing. I know, I can hear the sighs and your fists pounding against your desks, but it has proven to cut development time dramatically. If you want a recap, and a strong voice against lookup tables, Jake Christian does a good job summarizing it here: ...

When using a Settings.settings file in .NET, where is the config actually stored?

When using a Settings.settings file in .NET, where is the config actually stored? I want to delete the saved settings to go back to the default state, but can't find where it's stored... any ideas? ...

Encrypting Web.Config

Duplicate of Encrypting config files for deployment .NET and Encrypting config files for deployment What is the best approach and tools for encrypting information in web.config file? ...

Running an AnyCPU application as 32bit on 64 bit os

Is there a way to execute a .net application compiled under AnyCPU as a 32-bit application when running in a 64-bit Windows environment without recompiling as x86? ...

Configure .NET CLR RAM usage

Is there a method of configuring the .NET CLR RAM usage on my machine? Suppose I have 64GB of RAM and I want to limit it to 4GB? It this possible? Edit - The root of the problem is that I have a 64-bit application that runs fine on a 64bit - 4GB machine but when run on a 64bit - 64GB machine it fails (stops dead in it's tracks when al...

Why is casting faster then reflection in .NET?

I have an event handler that needs to determine a type and execute code if it matches a specific type. Originally we cast it to an object and if it wasn't null we executed the code, to speed it up I used reflection and it actually slowed it down and I don't understand why. here is a code sample Trace.Write("Starting using Reflection"...

How do I sort a string array alphabetically by length?

By alphabetically by length I mean as follows: given: { "=", "==>>", "=>>", "=>", "!>" } I want to get out: !> = => =>> ==>> I'm currently just using OrderBy(x => x.Length).ToArray() anyone got a better lambda? EDIT: I'm going about this ALL wrong, please vote to close! ...

Porting a .NET app to the Mac

I have been asked what it would cost to port a .NET application to Mac. I don't have enough knowledge to even give a rough estimate. I have not done anything on a Macintosh above surfing the web, and that was 10 years ago. My guess is that we probably have to write it from scratch in java or objective-c. We are a Windows/Linux shop, a...

.Net EntityFramework binding to gridview

For simplicity I am going to use Northwind as an example... I would like to have a databound DataView that displays "Order" information data from two different entities "Products" and "Order Details" I want to build a web form where when the user clicks on the screen to view a "Order" It would display a single databound Dataview that co...

workflow xoml file cannot deserialized after mapping XML namespace to a CLR namespace

I added the following attribute to the assemblyinfo.cs file in the activities project: using System.Workflow.ComponentModel.Serialization; [assembly:XmlnsDefinition("http://Myproject/MyActivitiesLib", "MyActivitiesLib")] also in my workflow runtime initilize methold, I loaded assemblyreference as following: using (WorkflowRuntime run...

How to read json with XmlReader

Given a stream of JSON, how can I read it as XML. I am aware of System.Runtime.Serialization.Json.XmlJsonReader but it is internal ...

Hide a datagrid column with Javascript?

I have a .net datagrid with some 20 columns. I need a column's visibilty to be toggled based on the click of a button using javascript. Any ideas? ...

Two SELECTS, One query

I want to pull down information from two tables from a db. One row from A, and the rows in B with an FK to the row I pulled from A. I'd like to make this a single stored proc with two select statements, rather than having to make two calls to the DB. I know several ways to pull the information from a single select...but can't remember...

DbParameter IsNullable functionality?

I have not worked with parameters in ADO.Net very much. I'm writing a custom .Net data provider (modeled on SqlClient), and have to implement the IsNullable property in my parameter class, which inherits from DbParameter. My data provider will not support stored procedures, so I will only be supporting Input (substitution style) parame...

Regex replace between multiple paragraphs (.Net)

Hi, it’s been a while since the last time I had to use regex, I am kind of in a hurry to accomplish something so I hope I can get a quick answer to this quick question. Say I have the following text: Start A B C End Start A B C End Start A B C End Foo A B C Bar I would like to replace the line breaks with pipes but only between t...

Dataset Sometimes has no tables after Fill

We have a winforms application calling a stored procedure every few seconds. The stored procedure always returns a resultset with 0 or more rows and the client fills a dataset. Once every few days or so we are finding that the dataset has no tables in it, and we can't figure out why. The process of firing the stored procedure does hap...