.net

Easiest way to add a Header and Footer to a Printing.PrintDocument (.Net 2.0)?

What's the easiest way to add a header and footer to a .Net PrintDocument object, either pragmatically or at design-time? Specifically I'm trying to print a 3rd party grid control (Infragistics GridEx v4.3), which takes a PrintDocument object and draws itself into it. The resulting page just contains the grid and it's contents - howeve...

Merging two arrays in .Net

Is there a built in function in .Net 2.0 that will take two arrays and merge them into one array? The arrays are both of the same type. I'm getting these arrays from a widely used function within my code base and can't modify the function to return the data in a different format. I'm looking to avoid writing my own function to accomplis...

How Do I Load an Assembly and All of its Dependencies at Runtime in C# for Reflection?

I'm writing a utility for myself, partly as an exercise in learning C# Reflection and partly because I actually want the resulting tool for my own use. What I'm after is basically pointing the application at an assembly and choosing a given class from which to select properties that should be included in an exported HTML form as fields....

Rhino Mocks: How can I mock out a method that transforms its input?

I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mocking my TransactionDao with RhinoMocks how can I indicate that it should transform its i...

Is a bool read/write atomic in C#

Is accessing a bool field atomic in C#? In particular, do I need to put a lock around: class Foo { private bool _bar; //... in some function on any thread (or many threads) _bar = true; //... same for a read if (_bar) { ... } } ...

Optimize Windows Form Load Time

I have a Windows Form that takes quite a bit of time to load initially. However, each subsequent request to load the Form doesn't take as long. Is there a way to optimize a Form's load time? ...

Detecting appilcation hangs with ActiveX controls in .Net

I am working on upgrades to a screen scraping application. We are using an ActiveX control to scrape screens out of an IBM mainframe. The mainframe program often hangs and crashes the ActiveX control causing our application to crash. We don't have access to the mainframe or the ActiveX source code. We are not going to write our own activ...

.NET visual components

I really like DevX components, but they are pretty expensive, maybe anyone knows free equivalents ? or web site where I can look for some kind of free visual component for .NET ...

Trouble with selected radiobuttonlist value on postback vb.net

I have a radio button list on a page that is used to configure products. when the page loads the first time the first list of options is displayed. you select one of them then click a "Next Step" button and the page posts back and shows a new radio button list for step 2. Now if i click a "Previous Step" button i can easily get the previ...

bug in linq Contains statement - is there a fix or workaround?

I found a bug in the Contains statement in Linq (not sure if it is really in Linq or Linq to SQL) and want to know if anyone else has seen this and if there is a fix or workaround. If the querysource you do the contains with has more than 10 items in it, it does not pass the items correctly to the SQL query. It is hard to explain what i...

Best method to obfuscate or secure .Net assemblies

I'm looking for a technique or tool which we can use to obfuscate or somehow secure our compiled c# code. The goal is not for user/data security but to hinder reverse engineering of some of the technology in our software. This is not for use on the web, but for a desktop application. So, do you know of any tools available to do this t...

What is the best book for learning WPF?

What is the best book for building WPF Business Applications? ...

XMLSerialization in C#

I have a simple type that explicitly implemets an Interface. public interface IMessageHeader { string FromAddress { get; set; } string ToAddress { get; set; } } [Serializable] public class MessageHeader:IMessageHeader { private string from; private string to; [XmlAttribute("From")] string IMessageHeade.FromAddress ...

C# NetCDF Library

I am currently working on (or at least planning) a couple of projects that work with large amounts of repetitive data. The kind of data that works well in a spreadsheet or database, but is nasty in XML. :) NetCDF seems like a great option for a file format. However, my work is in C# and there is no "official" NetCDF implementation avail...

Select rows in dataset table based on other dataset table

I have a dataset that has two tables in it. I want to do the following (or something like it) is it possible and is how I have it correct? dsTabData.Tables("FilingTabs").Select("fs_ID not in (select fsp_fsid from ParentTabs)") how do you reference data from other table in the same dataset? ...

Is it possible to embed and use a portable executable in a .net DLL?

The easiest way to think of my question is to think of a single, simple unix command (albeit, this is for windows) and I need progmatic access to run it. I have a single command-line based executable that performs some unit of work. I want to call that executable with the .net process library, as I can do with any other executable. Ho...

Is it possible to write ActiveX Controls in C# that will run in Excel?

I have been searching on the web for some example code on how we can write a custom ActiveX Control for use in Excel using .NET but so far I have found old articles suggesting that it is not supported. The application we are building uses Excel as a report writer so we which to add some custom controls to the worksheets to provide a ri...

Using the DLR for (primarily) static language compilation...

I'm building a compiler that targets .NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of the code is completely static. So now that that's been explained, I have ...

Getting started with REST

I am looking for some good links with best practices and sample code on creating RESTful web services using .NET. Also, any other input you might have regarding REST would be greatly appreciated. ...

Automate Safari web browser using c# on Windows

I wondered if anyone had successfully managed, or knew how to automate the Safari web browser on the Windows platform. Ideally I would like to automate Safari in a similar way to using mshtml for Internet Explorer. Failing that a way to inject JavaScript into the running process would also be fine. I've used the JavaScript injection met...