Hi,
I'm trying to implement a cancellable worker thread using the new threading constructs in System.Threading.Tasks namespace.
So far I have have come up with this implementation:
public sealed class Scheduler
{
private CancellationTokenSource _cancellationTokenSource;
public System.Threading.Tasks.Task Worker { get; private s...
I want to generate 25 unique random numbers and list them in a console. The numbers should be atleast 10 characters long. Any easy way to do that?
...
I would like to use the new concurrent collections in .NET 4.0 to solve the following problem.
The basic data structure I want to have is a producer consumer queue, there will be a single consumer and multiple producers.
There are items of type A,B,C,D,E that will be added to this queue. Items of type A,B,C are added to the queue in th...
I have a web solution that contains 5 class libraries and one asp.net web site project. It's an e-commerce solution that is compiled for .NET 3.5 (some class libraries are set to .NET 2).
When I got VS 2010 installed I decided to give a try and upgrading it to .NET 4 but that didn't go so well, can't remember why. I reverted the sou...
I see that a JSON serializer is present in the System.Web.Script.Serialization namespace, and is shipped in the System.Web.Extensions.dll assembly.
Is this assembly distributed with the .NET framework v4.0 redistributable? Is it also guaranteed to be present on a user's machine if any edition of Visual Studio 2010 is installed?
Adde...
I can do any .Net development using v2 of the CLR (.net 2, 3, 3.5) but when I try to use .Net 4.0 then I get an error saying that the version of IBM.Data.DB2 is too old / out of date (it's compiled for CLR v2).
Where would I find a .Net 4 version of IBM.Data.DB2?
...
I am currently trying to upgrade a project of mine from .NET 3.5 to .NET 4.0
Everything was going really well, all code compiled, all tests passed.
Then I hit a problem deploying to my staging environment.
Suddenly my logins were no longer working.
It seems my SHA1 hashed passwords are being hashed differently in .NET 4.
I am using th...
I've noticed that if I build my WPF application for Any CPU/x64, it takes MUCH longer to start (on the order of about 20 seconds) or to load new controls than it does if started on x86 (in release & debug modes, inside or outside of VS). This occurs with even the simplest WPF apps. The problem is discussed in this MSDN thread, but no ans...
Do the parallel-for in .net 4.0 takes privilege of GPU computing automatically? Or I have to configure with some drivers so that it uses GPU.
...
I am attempting to make a program that will pull data such as OS, IP, Server Name, Websites, Databases, etc. in a server farm. Is there a .Net library that allows you to connect to servers and get information such as this with the proper authentication? I do not really know where to start, thank you.
Most of the servers are 2003 stan...
I was using sandcastle to generate help for my project in visual studio 2008. When i change my project to visual studio 2010 and change the project .NET version to .NET 4.0 i got this problem with Sandcastel. I can't understand why sandcastel is using C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe
and not
C:\Windows\Microsoft.NET...
To clarify, the scenarios I am looking at involve deploying ASP.NET 4 Web Forms application that employ RouteTable.Routes.MapPageRoute:
public class Global : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
RouteTable.Routes.MapPageRoute("questionnaires", "questionnaires", "~/Pages/Questio...
I'm using the TFS 2010 SDK to programmatically check in edits to files into TFS 2010. The documentation on the TFS 2010 SDK is sparse at best. When I call the method workspace.pendedit() passing in an array of files I want to mark as having a pending edit, nothing is actually checked out. So when I call workspace.checkin() passing in wor...
It seems from the MSDN overview that the only change to ADO.Net in .Net 4 is the addition of Entity Framework.
I'm working on refactoring some legacy database access to use ADO.Net and one of the things I'd like to document as project issues is any benefit from moving to .Net 4 from the .Net 3.5sp1 we're currently targeting (we have a W...
I've created an ASP.NET MVC application that has an initializer attached to the PreApplicationStartMethodAttribute. When initializing, a collection is instantiated that implements an interface I've defined. When I instantiate this collection, w3wp.exe crashes with the following two incomprehensible entries in the event log:
Faulting app...
The following code creates the correct number of files, but every file contains the contents of the first list. Can anyone spot what I've done wrong please?
private IList<List<string>> GetLists()
{
// Code omitted for brevity...
}
private void DoSomethingInParallel()
{
var lists = GetLists();
var tasks = new List<Task>();
var...
I have a problem understanding what's causes the compilation error in the code below:
static class Program
{
static void Main()
{
dynamic x = "";
var test = foo(x);
if (test == "test")
{
Console.WriteLine(test);
}
switch (test)
{
case "test":
...
I ask though I doubt there is any such system.
Basically I need to schedule tasks to execute at some point in the future (usually no more than a few seconds or possibly minutes from now), and have some way of cancelling that request unless too late.
Ie. code that would look like this:
var x = Scheduler.Schedule(() => SomethingSomethin...
A very much related question has been posted here:
http://stackoverflow.com/questions/199080/how-to-detect-what-net-framework-versions-and-service-packs-are-installed
However, I found that .Net 4.0 conventions are messy. I need to hard-code some logic into an installer / installed product that goes like this:
if not RecentDotNet40IsIn...
Possible Duplicate:
What do you think of the new C# 4.0 dynamic keyword?
What do you think about the advantages/disadvantages of .net 4.0 dynamic types?
are they useful?
do we really need them?
what are their advatages?
thanks
...