.net

Why are C# arrays covariant and what benefits does it bring?

Hi all, I'm having trouble understanding why arrays in C# are covariant and what benefits this covariance can bring. Consider the following trivial code example: object[] myArray = new string[1]; myArray[0] = 1; This code will compile okay, but will unceremoniously and perhaps unsurprisingly explode at runtime. If I try to attempt t...

How can I package the .NET framework with an executable without using an installer?

I have an executable that displays a simple windows form. Unfortunately this application will not run if the user does not have the .NET framework installed. I would like to be able to detect if the user's machine has the .NET Framework installed, and if not, give them the option to download and install it. I know that this is possibl...

Performance issues with the ScrollViewer

There seems to be a performance degradation when an items collection control is decorated with a ScrollViewer. In the particular application I am working on, there seems to be a big hit to the application when I decorate a VirtualizingStackPanel with a ScrollViewer. I am trying to load up 250 items in this particular container with the h...

Ensuring Dispose is called when .net class expsed to COM

I've exposed a .net class to COM. The class inherits from IDisposable because I need to clean up some unmanaged resources. In the .net environment I would wrap my class in a using scope to ensure that Dispose() always gets called. Is there some facility to do this if I'm using the COM wrapper? I'm insantiating the class from VB6 and ...

Render Multiple Controls To Image

How can I render multiple controls (or the same control) to a bitmap on specified locations. For example render control1 in it's full size to the location (50;50) and control2 at location (100;100) and so forth. I've a control that needs to be rendered 6 times side-by-side on an image with a single property changed in each rendering. ...

What is the global distribution systems (GDS)? How to use this from my website?

Airlines have divested most of their direct holdings to dedicated GDS companies, who make their systems accessible to consumers through Internet gateways. Modern GDSes typically allow users to book hotel rooms and rental cars as well as airline tickets. What I want to know is,if I want to vertical search engine specially airline, how to ...

Read and write EXIF data with Silverlight

Hi, I'd like to find a way to read AND write exif data of an image with Silverlight. I couldn't find any sample code or library doing this, so I don't know if it's even possible? Thanks Update : I need to write (edit or add if necessary) exif data and more precisely the "Software" tag. ...

How do applications read assemblies and visualize .NET forms?

Applications like Passolo, Alchemy Catalyst and Lingobit Localizer can read DLLs and visualize .NET controls, such as windows, forms, and dialogs. How might something like this be done? ...

Open ITunes software from a ASP.NET application

I have a MP3 file on the server and want to make it easy for a user to add this to their ITunes library on a click of a button, so that they can add it to their Ipod. Is this requirement reasonable and possible? ...

.Net: DataGridView Responding to IBinding.ListChanged but not CellValueChanged Event Handler

I have a custom IBinding List which raises the ListChanged event. I would like to recolor the Datagridview row after the ListChanged event. The Datagridview is responding to ListChanged event and changes the cell value but the CellValueChanged event is never fired. What Datagridview event reflects the ListChanged event? Class CustomL...

Is it ok to hide a static method?

I have an abstract Catalog class as follows. It has a static method OpenCatalog() which is used to return a specific concrete catalog based on the type of location provided. Once it has determined the type of catalog it then calls a specific OpenCatalog() method of the correct concrete catalog type. For example I may have an implementati...

Single-file ASPX and LINQ

Hey, there's a CMS system and there's aspx page without backend file. I can add server code straight to the .aspx wrapped with <script language="C#" runat="server"> tag. But compiler generates an error because I use LINQ in my code and I don't have using System.Linq; statement anywhere. And I can't add using inside .aspx file (error aga...

Is it reasonable for a programmer to create a C# wrapper for video transcoding?

What can a programmer (one person) get from providing the community with opensourse (more or less) video transcoding library\wrapper? (I know we have Tao but it is not good for 2010...) I think of video transcoder based on FFMpeg. simple wraper which would simplify FFmpeg bringing to C# such functions like ReadFrame(bytearray, framenum...

Calculate scrollbar thumtrack size

I have a control where I use SetScrollInfo (user32) to set the nMin and nMax. How can I calculate the right size of the nPage (or the thumbtrack)? I know it must be some percentage of the client area, but I'm not really sure on the calculation. I am not using AutoScroll and associated properties so that I can have maximum control over sc...

How to use Matrix and scrollbar translate offsets for drawing

I'm using a Matrix to set a transformation on my Graphics object during OnPaint. I would like the scrollbars to translate the matrix when scrolled; something like this in OnScroll: float offset = se.NewValue - se.OldValue; if (offset == 0) { return; } if (se.ScrollOrientation == ScrollOrientation.HorizontalScroll) { this.Trans...

How do I use the translate function in a predicate of a XPath argument to XmlDocument.SelectNodes?

I'm using C# and .NET 2.0. Given the XML below, I'd like to get a XMLNodeList of <user> nodes where the <role> is "admin". <users> <user> <name>John Doe</name> <roles> <role>superadmin</role> <role>admin</role> </roles> </user> <user> <name>Jane Doe</name> <rol...

.NET ESB performance

I'm starting to design a new version of one of my company's telecommunications products, and to provide load balancing and scalability I was considering some kind of (.NET open source) ESB. I'm hoping to boost the throughput of the system by avoiding relational databases and use (perhaps) non-transactional queues feeding into distributed...

how to view mvc template within a webforms hybrid app; staring with webforms.

I'm starting with a legacy webfoms program and adding mvc. I have mvc setup, but I can't get the mvc templates to show. I dont have a csproj file; I only have a solution file that points to a folder containing the files of the project;note, it is not pointing to a .proj file. It seems that you can only specify one guid that determines t...

Storing 4 bits from a byte in VB.Net

What is the best way to store 4 bits from a byte in VB.Net? Where best means: Most straightforward method of storage from a Byte type. The easiest to work with while performing bitwise operations. Straightforward conversion of the bits to other types. Storing them in a BitArray via it's constructor reverses the order of the bits. This m...

How to import COM into Ironpython?

In Cpython, I can use win32com. But, in ironpython, I didn't know how to import it. Because, in .net, one always use Visual Studio to interop the COM and to use it. ...