.net

Dealing with null values from DB

The db I am querying from is returning some null values. How do I safeguard against this and make sure the caller gets some data back. The code I have is: Using DataReader while (dr.Read()) { vo = new PlacementVO(); vo.PlacementID = dr.GetString(0); If I use dataset, I can do it like this. o...

Castle Windsor with .net 3.5 framework

How can I use Windsor in my .net 3.5 solution? Can I use the binaries built for .net 2.0? Do I need to compile the Castle Windsor source myself, targeting 3.5? ...

XmlSerialize a custom collection with an Attribute

I've got a simple class that inherits from Collection and adds a couple of properties. I need to serialize this class to XML, but the XMLSerializer ignores my additional properties. I assume this is because of the special treatment that XMLSerializer gives ICollection and IEnumerable objects. What's the best way around this? Here's som...

Method overloading behaviour

I have the following code sample : public class Base { public virtual void MyMethod(int param) { Console.WriteLine("Base:MyMethod - Int {0}", param); } } public class Derived1 : Base { public override void MyMethod(int param) { Console.WriteLine("Derived1:MyMethod - Int {0}", param); } public...

Can you achieve encrypted bi-directional communication using WCF when the client can be behind a proxy,a firewall or a NAT ?

I have a client and a server both written in .net 3.5 so I've got no interoperability issues. The server is fully accessible on port 443 (I'm hosting it so I can open other ports if needed) The client is however less accessible. It's often behind a corporate firewall, or behind a NAT, or uses an http/https proxy to connect to the inter...

Using constrained generic extension methods in a separate assembly gives a reference error.

I created a separate assembly to contain common extension methods, the extension methods uses classes from System.Web.dll (and others). When I then create a new project (Console Application) that references the Utilities.dll assembly that contains the extension methods, I do not need to add a reference to System.Web.dll to the new proje...

What should the converter parameter be for this binding

I am trying to implement a wpf user control that binds a text box to a list of doubles using a converter. How can i set the instance of user control to be the converter parameter? the code for the control is shown below Thanks <UserControl x:Class="BaySizeControl.BaySizeTextBox" xmlns="http://schemas.microsoft.com/winfx/2006/xam...

Using Parallel Extensions In Web Applications

I'd like to hear some opinions as to what role, if any, parallel computing approaches, including the potential use of the parallel extensions (June CTP for example), have a in web applications. What scenarios does this approach fit and/or not fit for? My understanding of how exactly IIS and web browsers thread tasks is fairly limited...

How do I get intellisense in app.config for a custom section?

We have a custom section in my app.config file related to our IoC container class. How can I get intellisense when editing the config file for this section, as well as getting rid of the compiler messages informing me of the missing schema. I found this question here: app.config configSections custom settings can not find schema informa...

Options for predictable frame capture in .NET application

I am working in C# and have the need to capture individual frames of video files. As quickly as possible (faster than real-time), I wish to seek to a specific frame number and capture every nth frame to a graphic file format such as BMP or JPEG. It is highly desired that the frame that is captured be predictable and repeatable, i.e. do...

How to delete a file used by other process

Here's the deal. My WinApp is running, right? in let's say process 'A'.It creates a file and keeps the handle (keeps the file open for writing, this is a must). Then it starts other msbuild process, let's call it 'B'. This process is started with the System.Diagnostic.Process class. At some point, my WinApp (A) needs to delete the pre...

Cannot Detach from process using mdbg

Following on from this question I now have code that can attach to a process using the Mdbg API. The problem is that I can't detach from the process if I need to. When I call mgProcess.Detach().WaitOne(); ( where mgProcess is a MDbgProcess created from an MDbgEngine object ) I get the following error message: Process not synchronized...

MAPI, UAC & .NET

I've used MAPI to create emails with attachments from my application and it works very well on XP and Vista (without UAC). Of course, if you have UAC enabled, it just doesn't work (though it gives no errors, and doesn't prompt the user for permission to continue). I've done a bunch of reading and have found a lot of differing ideas: ...

Is there a Java Descriptor like thing in .Net?

I'm working on a static analysis tool for .NET assembly. In Java, there is a Descriptor which can be used to represent method or field in a string with specified grammar. for field: double d[][][]; will be [[[D It's useful especially when doing bytecode analysis. Coz it's easy to describe. If there a similar thing in .NET CLR? Or ...

How do I extract a string of text that lies between two (brackets) using .NET?

I have a string "User name (sales)" and I want to extract the text between the brackets, how would I do this? I suspect substring but I can't work out how to read until the closing bracket, the length of text will vary. ...

Moving files on different volumes in .NET

Hi, Apparently I can't move files on different volumes using Directory.Move. I have read that I have to copy each file individually to the destination, then delete the source directory. Do I have any other option? ...

Retrieving Dictionary Value Best Practices

I just recently noticed Dictionary.TryGetValue(TKey key, out TValue value) and was curious as to which is the better approach to retrieving a value from the Dictionary. I've traditionally done: if (myDict.Contains(someKey)) someVal = myDict[someKey]; ... unless I know it has to be in there. Is it better to just do: if (my...

Can I Reflector the .NET Base Class Libraries (BCL)?

BCL Specifically, am I breaking the EULA by doing this? ...

Configuration binding extension could not be found.

I have created a simple wcf service which used the WCF Service Library template. Everything works fine when using the default soap bindings, however when i attempt to modify the service to add a REST binding it fails with the following error: "Configuration binding extension 'system.serviceModel/bindings/webHttpBinding' could not be fo...

ReadOnly vs Property within Assembly Question/Conundrum

How can I make a Property "ReadOnly" outside the Assembly (DLL) for people using the DLL but still be able to populate that property from within the assembly for them to read? For example, if I have a Transaction object that needs to populate a property in a Document object (which is a child class of the Transaction class) when somethin...