.net

How can I tell whether I am on x64 or x86 using .NET?

I'd like to offer my users correct links to an upgraded version of my program based on what platform they're running on, so I need to know whether I'm currently running on an x86 OS or an x64 OS. The best I've found is using Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE"), but I would think there would be some built-in faci...

Debug VS Release in .net

Continuation to my previous question is any one aware of a comprehensive document what list all available differences between debug and release modes in C# application , and particularly in web application ? What differences you aware of ? ...

.NET: Get all Outlook calendar items

How can I get all items from a specific calendar (for a specific date). Lets say for instance that I have a calendar with a recurring item every Monday evening. When I request all items like this: CalendarItems = CalendarFolder.Items; CalendarItems.IncludeRecurrences = true; I only get 1 item... Is there an easy way to get all items...

Can you register an existing instance of a type in the Windsor Container?

In the Windsor IOC container is it possible to register a type that I've already got an instance for, instead of having the container create it? ...

How do I iterate a .Net IList collection in the reverse order?

I have an IList that contains items ( parent first ), they need to be added to a Diagram Document in the reverse order so that the parent is added last, drawn on top so that it is the first thing to be selected by the user. What's the best way to do it? Something better/more elegant than what I am doing currently which I post below.. ...

How do I best convert a string representation into a DbType?

Suppose I have a string 'nvarchar(50)', which is for example the T-SQL string segment used in creating a table of that type. How do I best convert that to an enum representation of System.Data.DbType? Could it handle the many different possible ways of writing the type in T-SQL, such as: [nvarchar](50) nvarchar 50 @Jorge Table: Yes,...

How do I best convert a DbType to System.Type?

How do I best convert a System.Data.DbType enumeration value to the corresponding (or at least one of the possible corresponding) System.Type values? For example: DbType.StringFixedLength -> System.String DbType.String -> System.String DbType.Int32 -> System.Int32 I've only seen very "dirty" solutions but nothing really clean. (yes...

Cruise Control and Obfuscation, How?

Hi there, this is my first question to stackoverflow so here it goes... I use cruise control for my continuous integration scheme, i want to use obfuscation in order to add another protection layer to my assemblies. The thing is that i don't know how to go about it since i couldn't find articles describing about this. Suggestions that i...

Delete DataGridView line

How can I delete a line form a binded DataGridView when pressing Delete key? ...

VS: Attribute for ignoring missing XML comments when building

I have a VS2008 solution using xml documentation, and we have warnings as errors turned on for release mode (a nice feature IMHO); this results, however, in long lists of 'missing xml comment' errors for such things as every element of a (self describing) enum. Does anyone know of an attribute or similar which switches off the requremen...

Is WebRequest The Right C# Tool For Interacting With Websites?

I'm writing a small tool in C# which will need to send and receive data to/from a website using POST and json formatting. I've never done anything like this before in C# (or any language really) so I'm struggling to find some useful information to get me started. I've found some information on the WebRequest class in C# (specifically f...

.NET's SslStream is always negotiating to the least secure cipher I have. How can I change this?

SslStream is supposed to negotiate the cipher type, key length, hash algorithm, etc. with its peer SSL stack. When using it in my code, I find that the negotiation always defaults to RC4 & MD5. I would like to use 3DES or AES for some added security. Looking around the web I find only a few references to this problem and no solutions; o...

How to escape brackets in a format string in .Net

How can brackets be escaped in a C# format string so, something like : String val = "1,2,3" String.Format(" foo {{0}}", val); doesn't throw a parse exception but actually outputs the string " foo {1,2,3}" Is there a way to escape the brackets or should a workaround be used. ...

How to wrap an existing memory buffer as a DC for GDI

I have a memory buffer corresponding to my screen resolution (1280x800 at 24-bits-per-pixel) that contains my screen contents at 24bpp. I want to convert this to 8-bpp (ie. Halftone color palette in Windows). I currently do this: 1. Use CreateDIBSection to allocate a new 1280x800 24-bpp buffer and access it as a DC, as well as a plain me...

How to remove all event handlers from a control

To create a new event handler on a control you can do this c.Click += new EventHandler(mainFormButton_Click); or this c.Click += mainFormButton_Click; and to remove an event handler you can do this c.Click -= mainFormButton_Click; But how do you remove all event handlers from a control? ...

Multi tenant architecture and NHibernate

Could anyone explain me finally what is the best strategy to implement transparent and fluent support of multi-tenant functionality in NHibernate powered domain model? Im looking for the way, how to keep the domain logic as isolated as possible from the multi-tenant stuff like filtering by TenantID etc ...

Programmatically setting the record pointer in a C# DataGridView

How do I programmatically set the record pointer in a C# DataGridView? I've tried "DataGridView.Rows[DesiredRowIndex].Selected=true;", and that does not work. All it does is highlight that row within the grid; it doesn not move the record pointer to that row. ...

.NET UML generation from code?

Is there anything out there that for .NET that can generate UML diagrams from code. Preferably an addin for Visual Studio. Starting work on a mature project that has little architectural documentation can be painful at first. Eventually you get the ins and outs of the code but helping to see how the code all fits together from the get go...

Set selected item on a DataGridViewComboboxColumn

I have a datagridview with a DataGridViewComboboxColumn column with 3 values: "Small", "Medium", "Large" I get back the users default which in this case is "Medium" I want to show a dropdown cell in the datagridview but default the value to "Medium". i would do this in a regular combobox by doing selected index or just stting the Te...

c# Creating hidden folders

Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#? ...