.net-4.0

WPF fluid layout and a listbox

Hi All, Im looking into how to make an effect on my WPF 4.0 application where I have a listbox that can switch from list view (i.e. a vertical stack of my own items) to a grid view (tiled list from left to right) via an animation (not a jump to and from). I have been looking into Fluid Layout in Blend 4, and messing around with it, but...

How would you refactor this Asp.net MVC 2 Html Helper?

Hi All, Quick question. How would you refactor this Asp.net MVC 2 HtmlHelper? Specifically would it make sense to use the TagBuilder class in this scenario? public static MvcHtmlString BusinessDisplayContacts(this HtmlHelper helper, string phone, string cellPhone, string fax, string website, string email, bool hide...

How to set Json.Net as the default serializer for WCF REST service

Is it possible to override the default WCF DataContractSerializer behaviour when Serialize/DeSerialize entities and use JSON.NET instead? I have the following service contract for handling the City entity. For design reasons the City entity has IsReference=true, and therefore the default DataContractSerializer raise errors. For the "GE...

TcpClient communication with server to keep alive connection in c#?

I've this TcpClient code which works fine. It connects to perl server on linux system and receives anything that server sents to it. Works nicely. public static void Main() { foreach (ProtocolConnection tcpConnection in TcpConnectionsList) { ProtocolConnection connection = tcpConnection; Thread...

Do .Net 4 Framework WinForms Applications Need Previous Versions?

.NET 4 has a new CLR. If I install the V4 framework on a PC will it install if there are NO earlier framework versions on that PC? Also, will my WinForms applications, targeted at .NET 4 run smoothly with no other framework installed? ...

How can you nibble (nybble) bytes in C#?

I am looking to learn how to get two nibbles (high and low) from a byte using C# and how to assembly two nibbles back to a byte. I am using C# and .Net 4.0 if that helps with what methods can be done and what libraries may be available. ...

Please help figure out what this C# method is doing?

I am a little confused as to what is being accomplished by this method. It seems to be attempting to break bytes into nibbles and reassemble the nibbles with nibbles from other bytes to form new bytes and then return a new sequence of bytes. However, I didn't think, you could take nibbles from a byte using modulus and subtraction and d...

Is this base40 and if so how can I decode it in C#?

I have several encoded strings and I need to decode them, my guess is they could be base40 encoding. I really need to decode, but it would be nice to do the encoding as well all in C#. BTW, I have tried all standard types of decoding before coming to the conclusion that it appears to be base40. I couldn't find anything about base40 enc...

Working with .net 4.0 on Biztalk 2006 R2

Hello, I am working on Biztalk 2006 R2 (With ESB guidance 1.0) I recently ended a development of a new model (Dot net model) on VS 2010 with dot net framework 4.0, the new model uses 4.0 features and cannot be downgraded. I have found out that the GAC was changed in the new 4.0 framework and is placed in a diffrent location (link text) ...

How to reverse the process of this C# Decode method to create an Encode method?

I would like to know how to reverse the process of the below DecodeBinaryBase64 so that I can have a matching Encode method. In short C# code that if given the output of this method it would return the same string that it took as input. private static string DecodeBinaryBase64(string stringToDecode) { StringBuilder builder = new S...

WPF 4 Drag and Drop with visual element as cursor

I have a WPF 4 app which I want to enable drag and drop with, currently I have it working with a basic drag and drop implementation, but I have found that it would be much better if, instead of the mouse cursor changing over to represent the move operation, I could use an image underneath my finger. I cannot seem to find any samples or ...

WPF drag and drop and update the UI at the same time

Im using WPF 4 and trying to get used to the Drag and Drop API with touch, not the mouse, I have easily got a drag operation working that drops onto a Grid, but what I want to do is, when the user is dragging over the grid, change its color. I have got all the code working, and I even put heaps of Console.WriteLine() calls within my Dra...

Why Tuple's items are ReadOnly?

I was thinking to use Tuple class to store 2 integer information (StartAddress, EndAddress) I need in my program. But I discover that Tuple items are ReadOnly, so if I need to set a value for an item, I need to re-instantiate a Tuple. What is the reason behind this design decision? ...

Can I deploy .net 4.0 web application on IIS6?

I've recently upgraded VS 2008 to VS 2010. On our server we have IIS6 installed and we can not change that in near future. Even though we will develop new applications to be deployed on IIS7 but if situation demands we may need to develop an application using .net 4.0 and to be deployed on IIS6, then in this case I wanted to know whether...

Impersonate a User from Code Behind via Forms Authentication

Is it possible to Impersonate a user when using Forms Authentication? The thing is that I want an external login for users and an internal site that just uses integrated windows security and the users need to be impersonated. I've looked around and found that John's answer here is really good, but I don't quite get how I can mix it up ...

How do I build MVC Contrib for .NET 4?

I've downloaded the source code, converted the solution to VS10 format, fixed all compilation errors (mainly deleted references to .NET 3.5 versions of System.Web.Routing and System.Web.Abstractions and added .NET 4 versions in their places) and compiled the project. But when I add a reference to one of the output assemblies (in this ca...

EF4 "Code Only" - How to set default value for POCO's

In Entity Framework 4, Code Only (CTP3), how do you set a default value for a property in the POCO's EntityConfiguration class? public class Person { public int Id { get; set; } public string Name { get; set; } public DateTime CreatedOn { get; set; } } public class PersonConfiguration : EntityConfiguration<Person> { public PersonCo...

C# 4.0: Method parameter default values as array

Is it possible in C# 4.0 method default values parameters as array (for ex. string[] sArray)? if yes, how to implement it? I tried call function like below: MethodA(string[] legends=new string[]{"a","b"},float[] values=new float[]{1,2}, string alt="sd"); It's not work ...

.NET 4 gotcha's and breaking changes

Possible Duplicate: Breaking changes in .NET 4.0 Does anyone know if there is a complete list with .NET 4 gotcha's and breaking changes? I found this one: ASP.NET 4 Breaking Changes but I also know that SmtpClient nowadays implements IDisposible and that's something I couldn't find on the page mentioned above. So is there a c...

.net 2.0 accessing .net 40 assembly thru binding

I have .net 2.0 application (third party) is window's application(DLL's) -> future plans to move to .net 4.0 .net 2.0 my application(web service /asmx) interacts with above windows application (DLL) . these DLL's are updated frequently every 2 months, so direct reference will not work hence my web service has bindings set in web config...