.net

What is standard CLR XML for a concrete generic that is an array?

This is a simple issue of me not knowing proper Xml syntax. In castle windsor I can duplicate this line of code: IoC.Container.AddComponent<IInputRequestedDialog<string>, SealsInputDialog>("seals"); With this Xml: <component id="seals" service="MyApp.InputRequestedDialog`1[[System.String]], MyApp" type="MyApp.SealsInputDia...

Non-trivial data binding

Trivial data binding examples are just that, trivial. I want to do something a little more complicated and am wondering if there's an easy, built in way to handle it. public partial class Form1 : Form { public Form1() { InitializeComponent(); List<DataStruct> list = new List<DataStruct>() { new DataStruct(){Name =...

#warning directive in VB.net

I know the #warning directive does not exist in vb.net... is there anything like it? I want to be able to throw messages (warnings) at compiler time. ...

How to save a PDF file Using NHibernate and SQL Server 2005

I'm developing a webapp where the user is given the chance to upload his resume in pdf format. I'm using NHibernate as a data mapper and MS SQL SERVER 2005. I want to be able to save the .pdf file to a given table... any ideas? Thank you very much! ...

HOWTO: specify in app.config to call a function before Main() is called?

I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing? ...

Why can't .NET parse a date string with a timezone?

.NET throws an exception trying to parse a datetime string in this format: Fri, 10 Oct 2008 00:05:51 CST Convert.ToDateTime("Fri, 10 Oct 2008 00:05:51 CST") results in an exception: The string was not recognized as a valid DateTime. There is a unknown word starting at index 26 Character 26 obviously being the start of "CST" ...

Installing .net Framework 3.5SP1 on top of 3.0 - as simple as "install and go"?

This maybe a stupid question, but as I can not easily undo my change if I decide to do it, I think i'd ask here first: I got a Sharepoint 2007 Server. Pretty standard stuff: Windows 2003 (32-Bit), IIS 6, Sharepoint 2007, .net 3.0. At the moment, I use Visual Studio 2005 with .net 3.0 as my target. However, I'd like to use .net 3.5SP1 F...

"The operation is not valid for the state of the transaction" error and transaction scope

I am getting a "The opertaion is not valid for the state of the transaction" error when I try to call a stored procedure that contains a SELECT Statement. Here is the structure of my calls public void MyAddUpdateMethod() { using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew)) { using...

XPS with Windows Forms

What is the best way to display and print XPS files in a Windows Forms application? ...

Visual Studio 2005 vs 2008 - What are the benefits?

What are the benefits of upgrading from Visual Studio 2005 to 2008? Any thoughts on whether it's worth the jump, or is it better to wait for whatever's coming next? ...

Getting image metadata in .NET without regards to metadata format

Given a filename, I need to be able to access certain metadata in an image for a (closed source) project I'm currently developing, without regard to how the metadata is stored (that is, Exif, IPTC, or XMP). In particular, I want to access geotagging data. Is there a way of doing this without requiring any third party assemblies or libra...

What are the most important parts of the .NET framework for a beginner?

You often see, on sites like The Daily WTF, examples of overengineered code that should have just been a call to a built-in method within the .NET framework. What namespaces/classes should be considered essential knowledge for a developer starting his/her first .NET job? As per Joel Spolsky's instruction for these types of questions, p...

C# and .NET FOLDERID

How do I use Windows Vista's FOLDERID API in order to retrieve filepaths for "known folders" such as System or Windows? I've seen some APIs but I don't know how to import them properly. And yes, I know this is a very newbie question, but I spent a half hour googling and couldn't find the answer; I'd also appreciate a way to find an answe...

Problem with NotifyIcon.ShowBalloonTip - balloon not showing up

I'm having trouble with something that I thought would be easy... I can't get my NotifyIcon to show a balloon tip. The basic code is: public void ShowSystrayBubble(string msg, int ms) { sysTrayIcon.Visible = true; sysTrayIcon.ShowBalloonTip(20, "Title", "Text", ToolTipIcon.None); } Nothing happens when I execute this code. I rea...

What sorts of things should I do to make a performant and robust reflection cache?

In .NET 3.5, I'm going to be working with System.Reflection to use AOP (probably in the context of Castle's Windsor Interceptors) to do things like define which security actions need to be performed at the method level, etc. I have heard that some parts of Reflection are slow (I've read the MSDN article around it), and would like to cac...

Assembly not saving correctly

I have some very simple code to generate an assembly and invoke a method on a contained type. The method gets called and runs correctly, however when I view the generated assembly using Reflector, I don't see the type. Below is the sample code: namespace ConsoleApplication2 { class Proggy { public static void Main(string[...

Call and Callvirt

What is the difference between the CIL instructions "Call" and "Callvirt"? ...

Anti virus integration with .net application

I would like to use anti virus integration with my .net application when uploading files using the application. Has any anti virus API available for .Net? ...

How to check if a number is an integer in .Net?

Say I've got a string which contains a number. I want to check if this number is an integer. Example IsInteger("sss") => false IsInteger("123") => true IsInterger("123.45") =>false ...

Passing data between business layer and data access layer - bad code?

I'm using the following code within the JCProperty class to retrieve data from a DAL: Dim x As JCProperty x = JCPropertyDB.GetProperty(PropertyID) If Not x Is Nothing Then Me.PropertyID = x.PropertyID Me.AddressLine1 = x.AddressLine1 Me.AddressLine2 = x.AddressLine2 Me.A...