.net

A data-structure for 1:1 mappings in C#

I want to temporary store some mapping data. The mapping is one to one. I saw this was solved in Python by wrapping two dictionaries in one class. In this case the O for getting mapped value would be O(1). I wan't the same thing. Does .Net already have such structure or I have to implement my own with two dictionaries? ...

How to change filetype association in the registry?

Hi there, first time posting in StackOverflow. :D I need my software to add a couple of things in the registry. My program will use Process.Start(@"blblabla.smc"); to launch a file, but the problem is that most likely the user will not have a program set as default application for the particular file extension. How can I add fi...

How exactly dependency injection is implemented internally in Spring.net?

I'm just curious to know about this.When i heard about Spring.net and tried some sample codes of DI i found it cool and eventually i was curious to know how it works and implemented internally? Even though have the src along with the framework i'm not yet good enough to find out where and how it is done. Is this something to do with Re...

Control ID rendering differently between environments

I have a web application that works in our stage/test environment fine but once we moved it to our production environment something weird happens. All the control ids change. For example a label went from ctl00_cphMainContent_lblPetName to _ctl0_cphMainContent_lblPetName. Why would this happen? What could cause something like this to h...

Why does My HTTP Web Request Code Not Send a Request?

How to post the following HTTP requests in C# POST http://10.0.0.1/st_poe.cgi Accept: image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */* Referer: http://10.0.0.1/RST...

Downloading video from YouTube

Hi! I wish to download a video from YouTube and then extract its audio. Can anyone point me to some C# code to download a video? Thanks! UPDATE: For clarification purposes, I already know how to extract audio from a .FLV file like these. Thanks! ...

Is anyone using System.Data.SQLite within SharpDevelop?

I was just wondering if perhaps any of you guys has been successful integrating SQLite into a SharpDevelop project? If that's the case it'd be really interesting if you wouldn't mind to go ahead and share the experience with the rest of us. I've tried the more sort of orthodox approach of using Visual Studio 2008 Express Editions and wh...

".NET Framework 3.5 Client Profile" Prerequisite not available in a ClickOnce Deployment

Hello, I’m trying to utilize the ".NET Framework 3.5 Client Profile" in my application but I’m not seeing the option under available perquisites. How do I get that option to show In Visual Studio 2008. This is for a ClickOnce deployment btw, and the below image is just to illustrate where ".NET Framework 3.5 Client Profile" is to go once...

What's the early history of the .Net framework?

What is the early development history of the .Net framework? (Before the release of .Net 1.0 in 2002) I've heard various stories about it, including that ASP.Net was originally written in Java, and that .Net was once called COM3, but certain versions of Windows thought that the project directory was a serial port. Does anyone have a mo...

Multi-variable complicated singletons

I have a pair of static fields with a complicated one-time initialization. I want this initialization to happen lazily, a la the standard singleton pattern. However, the initialization procedure involves both fields, so I can't separate it into two different singletons. What's the best way to handle this? ...

What's the best way to return an interface (and object instance) to a remote caller, having said Object method calls run in the hosting app?

I'm prototyping a C#/.NET client/server environment in which I need to return an object instance (already constructed with data the client needs- avoiding the exposure of server-side (read: internal database details) that the calling code needs to perform "remote" method calls on said instance. When the client code calls methods on this...

How to detect mouse wheel tilt?

To detect rotation of the mouse wheel in .NET/WinForms, I can override OnMouseWheel. Clicking can be detected by overriding OnMouseDown (it's just the Middle button). But how do I detect tilting of the wheel (tilt to the left/right for horizontal scrolling)? Neither OnMouseWheel, not OnMouseDown is being called when I tilt the mouse whee...

using registered com object dll from .NET

Hi all, I implemented a python com server and generate an executable and dll using py2exe tool. then I used regsvr32.exe to register the dll.I got a message that the registration was successful. Then I tried to add reference to that dll in .NET. I browsed to the dll location and select it, but I got an error message box that says: A ref...

How to get difference between two dates in Year/Month/Week/Day?

How to get difference between two dates in Year/Month/Week/Day in an efficient way? eg. difference between two dates is 1 Year, 2 Months, 3 Weeks, 4 Days. Difference represents count of year(s), month(s), week(s) and day(s) between two dates. ...

How to mimic built-in .NET serialization idioms?

I have a library (written in C#) for which I need to read/write representations of my objects to disk (or to any Stream) in a particular binary format (to ensure compatibility with C/Java library implementations). The format requires a fair amount of bit-packing and some DEFLATE'd bytestreams. I would like my library, however, to be as i...

Why does XSD.EXE Create Two .XSD Files, and How to Use Them?

Hello everyone, I am using the following command to generate related xsd file from my input XML file -- response.xml, my confusion is (1) why there are two xsd file output (response.xsd and response_app1.xsd), I think there should be only one of them generated? (2) If I need to generate C# class file by using xsd /classes, which xsd fil...

Want to make use of a DB without installing a DB engine in .NET

There is a small enhancement I'm adding to an application. It would be nice to provide the user with the ability to filter and sort without having to write a lot of code that's already implemented in a database engine. However, I cannot justify installing a full database environment for this small piece of functionality. I did have an ...

Play Sound in .Net using generated Waveform data

How can I play a sound based on waveform data that my .Net program is generating from user input and mathematical functions? By "waveform data" I am mean SPL values in a fixed interval time-series (probably 44.1 kHz). I presume that this requires some kind of streaming buffer arrangement. Note, that this has to be live/real-time, so j...

Why is the result of a subtraction of an Int16 parameter from an Int16 variable an Int32?

Possible Duplicate: byte + byte = int why? I have a method like this: void Method(short parameter) { short localVariable = 0; var result = localVariable - parameter; } Why is the result an Int32 instead of an Int16? ...

Use of Legacy "Communication" Classes in .NET Framework

I have a web application which passes long-running requests to a Windows Service on another computer, using .NET Remoting. I have been told that .NET Remoting is an obsolete technology, and that it should no longer be used. Should I rewrite the service using WCF, or leave it as it is? If I rewrite it, am I going to have to rewrite it ...