.net

Is there any way to convert 'Double' or 'double' to 'const Double' or 'const double' in C#?

My question is similar to http://stackoverflow.com/questions/955418/const-double-initialised-from-lua but I am asking this question Double W1 = -21.0; const Double X = (const Double) W1; is there any way to do so. And is there any difference between: double Y; Double Y; ...

Math.Atan2 or class instance problem in C#.

Here is my problem (C#) : double Y = 0.0; double X = -21.0; double q1_Test = Math.Atan2(0.0, -21.0); // gives Math.Pi double q1_Test2 = Math.Atan2(( double)Y, (double)X); // gives Math.Pi double w1 = <SomeclassInstanceGlobalHere>.getW1(); // This is a class which updates a variable double w2 = <SomeclassInstanceGlo...

Mantain a control position fixed when scrolling a panel

Hello. I have a label label1 in the middle left of a large custom panel panel2 that is scrolled in a parent panel panel1. I would keep the label1 always in the visible left middle of the panel2, even when scrolling. In the real example, my panel is a user control that generates the some labels in its left side. The panel scrolls, b...

Mixing MEF parts targetting .NET 3.5 with an application targetting .NET 4.0

The Managed Extensibility Framework is both a stand-alone project (currently targetting .NET 3.5) and part of the .NET 4.0 framework. Suppose I create assemblies targetting .NET 3.5 that contain MEF parts. These assemblies will reference the stand-alone version of System.ComponentModel.Composition.dll. Now suppose I create a MEF-enabl...

Silverlight - Grabbing all binding information of elements in a given visual stree?

We are loading some xaml for an Element at runtime (XamlReader.Load) for some preview purposes. Need less to say, the properties/bindings are not know as they can vary across elements/controls we are loading. As the run time view model context is not available when we load the control for preview - after loading the Element, the idea i...

.net value types

Please look at : http://msdn.microsoft.com/en-us/library/34yytbws.aspx In there, I read : Value types can have fields, properties, and events. I know what properties and events mean but what does fields mean? (This in preparation for MCPD certification) ...

Live Example of WCF

Hi, I want a live example of WCF Service. can anybody send me the url of the site that where WCF is implemented (except MSDN and Myspace). and I am also intereted about the developers who are working on WCF. Plese Help Thanks, Pradyut Sinha ...

Why does Monitor.Pulse need locked mutex? (.Net)

Monitor.Pulse and PulseAll requires that the lock it operates on is locked at the time of call. This requirement seems unnecessary and detrimental for performance. My first idea was that this results in 2 wasted context switches, but this was corrected by nobugz below (thanks). I am still unsure whether it involves a potential for wasted...

IMessageFilter.PreFilterMessage doesn't trap Combobox Messages

I am trying to use the PreMessageFilter method to do some basic logging to try and track down a "non reproducable" error we are having in a piece of our software. I would like to be able to log when a user types text into a textbox, and when they change a selection in a combo box. I have managed to use the WM_KEYDOWN message to log whe...

Conditional BreakPoint in VS - value is Changed. How to use?

Hello. In Visual Studio (2005/2008) we can set a conditional breackpoint when the condition is True. Now, there is an other option - when is "Changed". What does this mean and how/when should I use it. I saw already related page on MSDN but this "changed" it still not clear for me... Thanks. ...

Enterprise library handlingInstanceId

can i get handlingInstanceId without using custom handlers (i'm using standard handlers). ...

choosing the right control for developing windows application

Hi all, I am looking for a contol either listbox or listview to support my requirements. Basically how my application looks is: The background should be black when the user clicks any 'row' the row should get highlighted witgh grey. The user will have the ability to search items in this control. For example , if one of the row ...

IOEXCEPTION in C# compact framework when saving image

I'm saving an image from a web request and something really weird is happening. On roughly half of the 8,000 images I'm downloading I get IOEXCEPTION errors: ERROR_ACCESS_DENIED (5) INVALID_PARAMETER (87) Before I save the file using file.open, I check to make sure the file does not exist. The exception is thrown at this line of code: ...

Best ORM that can work with Service Broker and transactions

Greetings Is there a ORM (MS-Sql specific) that can work with transactions and is Service Broker friendly. What I’m searching for is the ability to work with the ORM tables, inside a transaction, and be able to do service broker calls inside the transaction (either by using an ORM object/method or by directly executing a command.Execute...

.Net Is it better to check in the updated AssemblyInfo.cs in a daily build?

At my job, the assembly version of each project in the source control is kept to 1.0.0.0. When the build machine make a new daily build, it has a task to update the assembly version but does not check in the updated assemblyinfo.cs. So on our dev machines, the assembly version of the dlls we are compiling are always set to 1.0.0.0. Is i...

Why is ForEach Method only on the List<T> collection?

First, let me specify I am refering to the List<T> method and not the C# keyword. What would be Microsoft's reasoning for having the Foreach method on the List<T> collection but no other collection/enumerable type, specifically IEnumerable<T>? I just discovered this method the other day, and found it to be very nice syntax for replacin...

Which namespace is the most underutilized, yet must-know for devs?

Which of the .NET 3.5 namespaces is the most underutilized yet contains some of the classes and methods considered "must-know" for every .NET developer? ...

How to test if hostname refers to local machine

Can anyone think of an easy way to tell in win32 or .NET if hostname (string) resolves to a local computer? Such as: "myhostname" "myhostname.mydomain.local" "192.168.1.1" "localhost" The goal of this exercise is to produce a test which will tell if Windows security layer will treat access to machine as local or network ...

playing a list of audio files in sequence

I've been confronted to a situation. I'm writing a Windows app in C# .NET. I want to play multiple .wav files one after another and do that continuously. is there a class that could allow that ? otherwise, how would I implement it ? I tried using MCI and it works, using the notify flag and interception of the MM_MCINOTIFY message but i...

I can't create a clear picture of implementing OOPS concepts, though I understand most of the OOPS concepts. Why ?

I have been working on some of the projects of my own and dont have any indrustial exposure. Currently i use simple approach for developing small applications with negligible OO approach like creating a common class for database functions using polymorphism of functions little bit use of constructors but i dont really able to think of ho...