.net

.NET: Determine the type of “this” class in its static method

Well, in a non-static method I could use this.GetType() and it would return the Type. How can I get the same Type in a static method? Of course, I can't just write typeof(ThisTypeName) because ThisTypeName is known only in the runtime. Thanks! ...

convert from HTML TO MS Word

I want to convert editor content to word document Iam using asp.net with VB code Please any body help me how to that and wich library should I use? ...

Are there good reasons for letting AssemblyVersion and AssemblyFileVersion match?

Gendarme has an AvoidAssemblyVersionMismatchRule with the following description: This rule checks that the [AssemblyVersion] matches the [AssemblyFileVersion] when both are present inside an assembly. Having different version numbers in both attributes can be confusing once the application is deployed. For example, this rule would ...

C#: Check if windows form

How can I check at runtime whether a C# application is a Windows application or a console application? I want to write a generic output library (output to textbox or console when console app). For that reason, if I could check whether it is a asp application would be useful, too. ...

How to mark a property as ReadOnly even if GetCreateInstanceSupported = true in winforms, .net

Using the CreateInstance method of the TypeConverter class, it's possible to edit the properties of an immutable object - such as a font. However, unlike the font class, there's some properties in my class that i'd like to be browsable but readonly - even though CreateInstance is supported. Is there an attribute that supports this? ET...

Adding custom project to Visual Studio 2008 - MPFProj compiling problem

I'm trying to add new project type in Visual Studio 2008, using Visual Studio 2008 SDK, following the instructions in this tutorial. I have also included the following folders from Visual Studio 2008 SDK directly to my source code: c:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Common\Source\CSharp\Languag...

POCO Support in the Entity Framework

While the application I am developing at the moment is written in .net 4.0 against the beta, I have largely been ignoring POCO support in the Entity Framework because I didn't need it. I'm starting to realize, however, that POCO support would be useful in my project. However, Google searches on POCO in the EF yield a lot of results about...

Bind a control to a single value in a collection/array in WPF

Hi there In WPF I have a collection of bool? values and I want to bind each of these to a separate checkbox programmatically. I want the bindings to be TwoWay so that changing the value of the individual item in the collection in code updates the check box and vice versa. I have spent ages trying to figure out how to do this and I am c...

What is a general step-by-step guide to create a custom framework in .NET?

Is there such a thing as a step-by-step guide to create a custom framework in .NET? I am trying to create one myself, have been reading the materials on the MS website about assemblies and GAC etc. but am getting more and more confused. I am not trying to do anything particular at this point. I am just trying to learn how to develop...

T-SQL Reporting Duplicate Key Exception to user in simple manner

I have a simple country table using a identity column for the primary key. There are also columns used to contain the 2 letter and 3 letter ISO-3166 Country Codes. Each of these columns is defined as a unique index. On Inserts/Updates I want to simply notify the user if the ISO Code entered is already in use. I am relying on the databas...

Is there a WCF server implementation of Web Sockets form HTML 5?

I would like to play with the new Web Socket support in Chrome (and soon Firefox), but have been unable to find a WCF implementation that will act as the server. Have somebody implemented a .net WCF Web Socket based server? ...

Data Binding Dissimilar Types...

Trying to accomplish: I want to change the image property of a bound tree node when the value of an enumerated property changes on the bound object. Bound Object is representation of an airfield or vehicle base in a game. The object has a property of Type which is an enumerated value type: SmallAirfield, MediumAirField, LargeAirField, ...

How to insert my application to Windows right click menu ?

Hi, I would like to write a C# .NET program that will do some transformations to selected images. After I select several images on my desktop (or any other windows folder) and right click them, I would like to see my program in the appeared menu. How can I insert my program to this menu, and execute it when this option is clicked ? I wo...

Is there a .Net API for Windows Error Reporting

Is there a .Net API for me to integrate Windows Error Reporting into my application? I'm mostly interested in initiating error reports even for non-catastrophic errors occurring in my application and all I could find is the WIN32 API. ...

Is there a bug in this code from 101 LINQ Samples on MSDN? (Update: Fixed)

NOTE: Charlie Calvert replied below that the 101 LINQ Samples have now been updated with correct code. The MSDN Visual C# Developer Center has a section called 101 LINQ Samples. I found this through a Bing search. The code for SelectMany - Compound from 1 is: public void Linq14() { int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 }; in...

Performance of calling delegates vs methods

Following this question - http://stackoverflow.com/questions/2082615/pass-method-as-parameter-using-c and some of my personal experience I'd like to know a little more about the performance of calling a delegate vs just calling a method in C#. Although delegates are extremely convenient, I had an app that did lots of callbacks via deleg...

Communication within .net apps on same machine + HID

Hello all, im looking for some more ideas for an architectural solution to the following. Our eng team is putting together a function specific computer for us. It runs Xp Embedded. our eng team has also developed two controllers (hardware) that are specific to the purpose of the computer and these controllers shall be seen as HID on the...

Reflection, has IsClass but no IsStruct?

How do i check if a Type is a struct? IsClass worked perfectly then my reflection stop behaving as i expected when i change the class to the struct. How do i check if its a struct? -edit- i need to check for class/structs. Nothing else, i cant match longs, ints, etc by accident. DateTime may be ok i am using this to search a Attribute/Fi...

Permissions problem when starting .NET app from .NET service as a different user?

Hello, I'm trying to start a .NET application under a different user from a .NET service. The idea is to create a sandboxed hosting application in windows. In the service, I programatically created the user in windows, create a folder for that user, and download the host .exe from a server into that folder. I then I run the host .exe us...

Open Source Video Gesture Recognition Library in C#

I need an open-source Video Gesture Recognition .NET Library/API (in C#). We have a web cam... we move a hand and it causes some events... So I need motion detection for navigation lib/api... Where can I find such a library? ...