.net

C# int, Int32 and enum's

If int is synonymous to Int32 why does enum MyEnum : Int32 { Value = 1 } ...not compile? Where as enum MyEnum : int { Value = 1 } will, even though hovering the cursor over the int word will display struct System.Int32? ...

Using legacy COM component in C# multithreaded Environment

Hi I have legacy COM component, and my mission is to write web service that wrap the COM and enable concurrent non-blocking calls. First of all, because the COM object itself is stateless, i decided to use the [ThreadStatic] attribute so each thread will have its own instance of the COM object to prevent the use of lock { } statement a...

.NET/C#: Using RSS.NET with Stack Overflow Feeds: How To Handle Special Properties of RSS Items?

I'm writing a Stack Overflow API wrapper, currently at http://soapidotnet.googlecode.com/. I have a few questions about parsing SO RSS feeds. I've chosen to use RSS.NET to parse the RSS, but I have a few questions about my code (which I have provided further down in this post). My Questions: First of all, am I parsing those attribu...

Action<T> to call a method based on a string value

Is there a way to use Action to call a method based on a string value that contains the name of that method? ...

OpenNetCF - Stay Connected to Ad-Hoc Network

I'm coding in OpenNetCF for WIndows Mobile 6.0. I need my application to connect to a particular Ad-Hoc network. I find that if there is no other device connected to that same Ad-Hoc network, the device automatically switched back to some other network (that is currently available). I want my application to stay connected to the Ad-Hoc n...

How can I write an Exif header without recompressing the JPEG, in .NET?

I have a JPEG image that I want to set an Exif header to (particularly, Author). In .NET, I can do this relatively easy using GetPropertyItem and SetPropertyItem, but in order for that change to be persisted to the actual .JPG file, I need to Save it, which basically recompresses the image. Is there any way to do this without recompres...

What happens to a WeakReference after GC of WeakReference.Target

What happens to the WeakReference when the target object referenced by WeakReference.Target has been garbage collected? Does the WeakRerence stay alive and keeps existing? The reason why I am asking is that I have a list of WeakReferences stored in a List. During runtime new WeakReferences constantly are getting added to that list. Now w...

Should I put custom code inside Microsoft's BCL/FCL namespaces?

A .NET programmer is allowed to wrap code inside namespaces and also to use a namespace already defined, even those defined by Microsoft in the Framework or Base Class Library. For example if I were to use System.Windows.Forms to outline this idea: Reference in assembly System.Windows.Forms.dll // This is my own C# source code file. u...

How do you include an external library in your own project for C++?

Hey guys, So I'm quite new to C++, I've basically been coding it all semester for a class. For our final project, we made an email client in C++ with .NET, and to do all the email sending and receiving, we went with using the POCO email client. Now, basically in order to use the POCO library, I've compiled it and done a number of thing...

(.net) Changes to included child XSL file is not picked up until parent XSL file is touched?

Ok so I've got a XSL file of handy templates in a file which a bunch of other XSL files include (using ) to keep my design nice and DRY. I'm using .net to run the XSL files against my XML. Trouble is when I make a change to the child XSL files and rerun my tranformations (ie refresh the browser) the change is not shown, it won't be unti...

Complex (custom method call) Dynamic Filtering at runtime in C# ?

In SQL one could pass a complex where clause as a string like some date calculation, this even at runtime. For example, letting a (poweruser) user define the where clause which can contains custom predefined functions like date functions. How to do the same thing in pure C# when filtering a datatable ? ...

Multiple-instances lock?

I am using a mysql db. Right now for my multithreads i use lock(staticVar){...}. It works fine. But i can add data via the command line which also uses the DB. It will occasionally throw an exception or cause my main instance to throw an exception from the sqlite db being lock. How can i create a mutli instance lock so i no longer get t...

Best way to wire events to an object?

I have a class which has a member object (class variable). This object has some events. I'd like to expose these events directly in my class. What is the best way to do this? ...

ASP.NET - Display Images and pdf in a GridView

I want to display in an asp:GridView an "Images" column. The idea is to provide a thumbnails of the image with link to real size image. For some rows, this may alternatively be a PDF document. I'd like the link to be to the PDF. The PDF or image are stored in a SQL database. Now I have error in Handler (.ashx) file: "Invalid attemp...

Is there a Sync Provider (for Microsoft Sync Framework 2.0) for an FTP site?

I'd like to synchronize a file directory with an FTP directory using Microsoft Sync Framework 2.0. There is a provider for the file system. But is there one for an FTP site? Or I need to write my own? ...

Is there a way to silently or automatically install .NET?

I am selling desktop software written in C# to multiple clients, and having a huge problem: The .NET install. The users of this software are not computer-savvy and usually don't have any version of the .NET framework installed, and many times don't want it. Nearly every single one of my support requests is due to someone not installing...

Graphics.DrawImage Doesn't Always Paint The Whole Bitmap?

I have run into a strange problem when using Graphics.DrawImage. When using e.Graphics.DrawImage(Image, Point) in OnPaint to paint a bitmap 'buffer' on the control, it appears that parts of the image are omitted. The buffer is populated in a helper method which draws directly onto the Bitmap using a Graphics constructed from it. Wh...

Are there any non-repeatable IEnumerable classes?

Are there any non-repeatable IEnumerable classes? By non-repeatable I mean where you can't safely call GetEnumerator multiple times or where calling GetEnumerator has observable side effects. ...

Going live with a project with no bugs generation

What are the ways to ensure that minimum or no bugs are found when a .net project goes live? Your tips can be generic. My first project is about to be hosted in a week's time and I am slightly intimidated by that fact, since I am a uni student and not an expert programmer. ...

Why do we need SDK along with .NET Framework?

We have to install Windows SDK along with .NET Framework. Why do we need the SDK if we have the framework? EDIT: This isn't just the case for .net development. Also, if you want to develop Silverlight apps, you have to install additional sdk. Why? ...