.net

Avaliable parallel technologies in .Net

I am new to .Net platform. I did a search and found that there are several ways to do parallel computing in .Net: Parallel task in Task Parallel Library, which is .Net 3.5. PLINQ, .Net 4.0 Asynchounous Programming, .Net 2.0, (async is mainly used to do I/O heavy tasks, F# has a concise syntax supporting this). I list this because in M...

problem with windows forms application settings

I have used Visual Studio to generate a class for application settings in a windows forms application. The application settings aren't populated with values when debugging. Why are there no values? Here is the generated code: //------------------------------------------------------------------------------ // <auto-generated> // Thi...

So do C#4.0 Code Contracts Actually Do Anything?

After reading about the System.Diagnostics.Contracts.Contract static class that has been influenced by the awesomeness of Spec# I was thrilled and immediately started peppering my code with calls to Contract.Requires() and Contract.Ensures(). I guess it's just because my code is so super-awesome and bug-free that checking that those c...

After install of VS 2010, many powershell scripts broken

I recently upgraded to VS 2010. Shortly after I noticed many powershell scripts I had written in the past no longer worked correctly. I am guessing that its because of .NET 4. Is there any way to fix this, or force powershell to use the older .NET? Thanks for any help anyone can provide. ...

Using .NET Regular Expression, match any string with exactly 9 digits

I'm trying to create a regex expression to match any string that has exactly 9 digits. the digits can exist anywhere in the string. For example, if you passed in the following strings, you'd get a match: 123456789 123aeiou456abc789 These strings would fail to provide a match 12345678 1234567890 ...

Common programming mistakes in .Net when handling exceptions?

What are some of the most common mistakes you've seen made when handling exceptions? It seems like exception handling can be one of the hardest things to learn how to do "right" in .Net. Especially considering the currently #1 ranked answer to Common programming mistakes for .NET developers to avoid? is related to exception handling. ...

How do I get events to execute on the "main thread"

I have 2 classes, one is frmMain a windows form and the other is a class in vb.NET 2003. frmMain contains a start button which executes the monitor function in the other class. My question is, I am manually adding the event handlers -- when the events are executed how do I get them to excute on the "main thread". Because when the toolti...

Disable VB.NET 10 Features in VS 2010

is there a way to disable visual basic 10 language features in VS 2010. our Dev team has moved to Visual studio 2010, but we still have to keep backwards compatibility with Visual Studio 2008. is there a way to disable the new language features to avoid any issues. ...

Inconsistent Behavior From Declared DLL Function

Why might my GetRawData declared function return a correct value when called from my VB.NET application, but return zero when called from my ASP.NET page? The code is exactly the same except for class type difference (Form / Page) and calling event handler (Form1_Load, Page_Load). Note: In the actual code, #DLL# and #RAWDATAFILE# are b...

How can I get .NET/Silverlight source code symbols to work in VS 2010?

Back when M$ first released the ability to point visual studio at a symbol server and actually debug into .NET code I got it up and working no problem on VS2008. Now trying to do this with VS2010 or my local copy of VS2008 doesn't seem to work. It successfully downloads the symbols and the stack frames turn from gray to black but the...

System.DirectoryServices.AccountManagement functions fail to probe some machines (but not others)

Both the working and failing targets are machines in the same domain. Code is down below. When I use it against some machines in my domain, I get a System.DirectoryServices.AccountManagement.PrincipalOperationException with a message: "While trying to retrieve the authorization groups, an error (1332) occurred." The error is thrown by Ge...

ASP.Net Entity Framework, objectcontext error

I'm building a 4 layered ASP.Net web application. The layers are: Data Layer Entity Layer Business Layer UI Layer The entity layer has my data model classes and is built from my entity data model (edmx file) in the datalayer using T4 templates (POCO). The entity layer is referenced in all other layers. My data layer has a class call...

WinForms - DateTimePicker default month selection behavior for Server 2003 vs Server 2008?

Good Afternoon! Has anybody else noticed a change in the default behavior of the "next" and "previous" month arrows in the standard WinForms DateTimePicker control? I have users running on both Windows Server 2003 and Windows Server 2008 R2, and they are reporting that on 2008 (and Vista/Win7), clicking the right or left arrows on the ...

How to query an .NET assembly's required framework (not CLR) version?

Hi, we are using some kind of plug-in architecture in one of our products (based on .NET). We have to consider our customers or even 3rd party devs writing plug-ins for the product. The plug-ins will be .NET assemblies that are loaded by our product at run-time. We have no control about the quality or capabilities of the external plu...

using MEF with NHibernate and windsor

I have an ASP.net MVC application that is using NHibernate under the covers for data access. I'm using the Windsor container to handle injecting ISession references into each controller. This works great, but now I'm looking to expand my application with a pluggable architecture so that I can have a core product and specific add-ons. ...

How do I programatically load a XAML Resource Dictionary located in another assembly?

I have seen this this post that shows how to do it from XAML, but how can I get a ResourceDictionary object from a Resource dictionary located in a different assembly? The XamlReader.Load has an option to take a filename parameter, but I dont think it works with the pack uri syntax. Any ideas? ...

Get individual query parameters from Uri

I have a uri string like: http://example.com/file?a=1&amp;b=2&amp;c=string%20param Is there an existing function that would convert query parameter string into a dictionary same way as ASP.NET Context.Request does it. I'm writing a console app and not a web-service so there is no Context.Request to parse the URL for me. I know that it...

SpeechSynthesizer Exception - Please Help

Hi. I have the following code: private List<VoiceInfo> GetInstalledVoices(SpeechSynthesizer synthesizer) { CultureInfo currentCulture = CultureInfo.CurrentCulture; var listOfVoiceInfo = from voice in synthesizer.GetInstalledVoices(currentCulture) selec...

Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones

Basically, I'm trying to grab an EXE from CNet's Download.com So i created web parser and so far all is going well. Here is a sample link pulled directly from their site: http://dw.com.com/redir?edId=3&amp;siteId=4&amp;oId=3001-20_4-10308491&amp;ontId=20_4&amp;spi=e6323e8d83a8b4374d43d519f1bd6757&amp;lop=txt&amp;tag=idl2&amp;pid=105...

Silverlight 3-4 reference kind (e-)book.

Hello! I'm looking for a source of information about Microsoft Silverlight to begin practically efficient programming custom functionality applications. I want to pretend just for now that I don't need any ideologically correct refresher (SL tips, top patterns, VS tutorials :) and etc.). Basically, what I want is a reference kind e-book...