.net

Data Strategies in Windows Mobile

I'm developing a C# application on Windows Mobile, and like most of my WM applications, I always get bogged down whenever I'm deciding on a serialization strategy. In the desktop world, I'm not too worried about it because i've already developed a pretty robust custom xml serializer - however, in the WM world, I don't want to use it be...

Double-checked locking in .net

I came across this article discussing why the double-check locking paradigm is broken in java. Is the paradigm valid for .net (in particular, C#), if variables are declared volatile? ...

We need to lock a .NET Int32 when reading it in a multithreaded code?

I was reading the following article: http://msdn.microsoft.com/en-us/magazine/cc817398.aspx "Solving 11 Likely Problems In Your Multithreaded Code" by Joe Duffy And it raised me a question: "We need to lock a .NET Int32 when reading it in a multithreaded code?" I understand that if it was an Int64 in a 32-bit SO it could tear, as it is...

Transparent images with C# WinForms

I am working on a Windows Forms application in VS 2008, and I want to display one image over the top of another, with the top image being a gif or something with transparent parts. Basically I have a big image and I want to put a little image on top if it, so that they kinda appear as one image to the user. I've been trying to use a pi...

What potential do you see in Silverlight?

Silverlight has been available since quite some time, and Silverlight 2 allows .Net programming on the front-end. I've been thinking about the apps that I can make using Silverlight, but I can't decide if I should go for development in Silverlight because i am still concerned about accessibility and acceptance. What potential do you see...

.NET Reflection - Finding the type that defines a static member

I have a problem with reflection. I need to find the type that instantiates a static member. My code looks like this: private class SimpleTemplate : PageTemplate { internal static readonly IPageProperty NameProperty = PropertyRepository.Register("Name"); } The PropertyRepository is a repository of prope...

Is it Possible to Make a Generic Control in .Net 3.5?

Hi all, I've got a control that's declared thus: public partial class MessageBase<T> : UserControl { protected T myEntry; public MessageBase() { InitializeComponent(); } public MessageBase(T newEntry) { InitializeComponent(); myEntry = newEntry; ...

How to loop thru a checkboxlist and to find what's checked and not checked

Hi, i'm trying to loop thru items of a checkbox list. if it's checked, I want to set 1 value. If not, I want to set another value. I was using the below but it only gives me checked items: foreach (DataRowView myRow in clbIncludes.CheckedItems) { MarkVehicle(myRow); } TIA! ...

Given an Object, How can I programatically tell what Interfaces it supports?

Given this: Interface IBase {string X {get;set;}} Interface ISuper {string Y {get;set;}} class Base : IBase {etc...} class Super : Base, ISuper {etc...} void Questionable (Base b) { Console.WriteLine ("The class supports the following interfaces... ") // The Magic Happens Here } What can I replace "The Magic" with to display the...

If/Else vs. Switch

I am curious to know if anyone has looked into this but what is the benefit/downside to using a Switch statement vs. an If/Else in the .NET Framework, specifically in C#. I can't imagine there being that big of a difference, or than maybe the look of your code. Would be interested to see what everyone says. ...

WPF: How to swap Listview cell content with a datatrigger (or equivalent)

I have a WPF App that implements a ListView. I would like to show an image (a small icon) in one of the columns depending on the type of the data that row represents. Sort of like the display you see in Windows Explorer. I am using DataTriggers elsewhere in my XAML, it seems like a similar method could be used to swap out entire cell c...

How Do I Know When I Am Skilled Enough To Get A C#/.NET Job?

Here's the core question: What do I need to be able to know and do to get a .NET software development position? I have been out of the software development career field since 2004, having worked for the government for about 6 months after graduating from college with a degree in computer science. I did well in college, very well, I ...

Strip Comments from XML

I've encountered the need to remove comments of the form: <!-- Foo Bar --> I'd like to use a regular expression that matches anything (including line breaks) between the beginning and end 'delimiters.' What would a good regex be for this task? ...

User/Pass Authentication using RESTful WCF & Windows Forms

Hi all, What is the best approach to implementing authorisation/authentication for a Windows Forms app talking to an IIS-hosted RESTful WCF Service? The reason I ask is I am very confused, after sifting through different articles and posts expressing a different method and eventually hitting a ~650 page document on WCF Security Best Pr...

.NET AddIn development

Hi, I'm writing a program that allows developers to write AddIn's for it and I'd like developers to be able to hook into events happening in the program. My code isn't compiling because I can't declare a delegate in the IMyProgram interface. So I suppose this is more of a design question. How would you go about getting an interface pa...

A C# / .NET (VS 2008) to Outlook (2007) question

Hi, I need some help with .NET (C#) and MS Outlook. I'm building a simple desktop application and want to send an e-mail using Outlook. If my desktop app generates a message, it should be able to send it as an email via outlook (we can assume outlook is running on the same PC) - a very simple operation. If I can do 1, that's great. If...

Remote Debugging in Visual Studio (VS2008), Windows Forms Application

Hi I'm trying to Remote Debugging a Windows Forms Application (C#), but i'm always getting this error: Unable to connect to the Microsoft Visual Studio Remote Debugging Monitor named 'XXX. The Visual Studio Remote Debugger on the target computer cannot connect back to this computer. Authentication failed. Please see Help f...

Multi-core usage, threads, thread-pools

I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering how the operating system and/or framework (this is .NET) deals with cores that are heavily used. Here's my questions regarding threads: When a new thread is spawned, what is the algorithm for assigning the thread to a particular c...

.NET OpenSource projects and strong named assemblies?

I am currently thinking about open-sourcing a project of mine and am in the process of preparing the source code and project structure to be released to the public. Now I got one question: how should I handle the signature key for my assemblies? Should I create a new key for the open-source version and publish it along with the other fil...

Is .NET System.Net.CookieContainer thread safe?

Is the .NET class System.Net.CookieContainer thread safe? --Update: Turnkey answered-- Is there any way to ensure thread safeness to variables which are modified during asynchronous requests (ie. HttpWebRequest.CookieContainer)? Is there any attribute to highlight thread safe classes? --Update: If thread-safeness is described on MSDN th...