.net-3.5

Using LINQ how do I have a grouping by a "calculated field"

I am using LINQ to EF and have the following LINQ query: var results = (from x in ctx.Items group x by x.Year into decades orderby decades.Count() descending select new { Decade = decades.Key, DecadeCount = decades.Count() }); So this kind of gets me to where I want to be, in that I get the...

Select the maximal item from collection, by some criterion

i am new to .net 3.5. I have a collection of items: IList<Model> models; where class Model { public string Name { get; private set; } } I would like to get the element, which has the longest name's length. I tried string maxItem = models.Max<Model>(model => model.Name.Length); but it of course returns ...

Slow SelectSingleNode

I have a simple structured XML file like this: <ttest ID="ttest00001", NickName="map00001"/> <ttest ID="ttest00002", NickName="map00002"/> <ttest ID="ttest00003", NickName="map00003"/> <ttest ID="ttest00004", NickName="map00004"/> ..... This xml file can be around 2.5MB. In my source code I will have a loop to get nicknames In each ...

WCF Book Recommendation

Touched on in other questions, but not directly...which WCF book(s) would you recommend? ...

Catch block not catching exception

...

A new expression requires () or [] after type compilation error - C#

The following code for a co-worker throws the following error when he tries to compile it using VS 2008: Error: A new expression requires () or [] after type Code: MyClass Structure: public class MyClass { public MyClass() {} public string Property1 { get; set; } public string Property2 { get; set; } } Sample So...

Unable to add a Service Reference to any WCF Service

I'm using Visual Studio 2008 SP1 on .NET 3.5 SP1 on Vista Any time I try to add a Service Reference to any WCF service I get an error that says "Could not load type 'System.ServiceModel.FaultImportOptions' from assembly 'System.ServiceModel,Version=3.0.0.0, Culture=neutral, PublicKeyToken=..." This happens when I try to connect to eith...

Add Checkboxes to VB.NET WPF 3.5 TreeView

Is it possible to add checkboxes to the WPF TreeView object? I'd like to have someone be able to check a specific entry for data retrieval at a later time. Thanks for the help in advance! JFV ...

MySQL .Net Provider 5.2 does not show up in Data Source dialog of VS 2008 Express

Hi, I have installed MySQL .NET data provider 5.2 (through it's installer) but I could not see the MySQL data provider in Data Source dialog of Database Explorer. I am using VS 2008 Express edition. Do you have any clues ? Regards, Jatan ...

AutoCompleteExtender works sometimes.

[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] GetRowsByFilter(string prefixText, int count) //public static List<string> GetRowsByFilter(string prefixText) { DataTable table = ds.Tables[0]; string filter = "stShortName LIKE '" + prefixText.Replace("'", "''") ...

I18N and L10N in WPF through XAML.

Hi All, If anybody know how to do the Internationalization and localization in WPF through only XAML. I have already done through WPF .cs file by using Resource Manager class. I would greatly appericiate, if anybody can guide me and given me the code samples. Thanks in advance, Cheers... Karthikeyan Manickam. ...

Search Engine Site Map Asp.Net

If possible can anyone tell me how can I implement a search engine sitemap with asp.net. My website has content that expires frequently and new stuff comes in, that's why I wanted it updated whenever the search engine crawler comes to my site. I came across http://weblogs.asp.net/bleroy/archive/2005/12/02/432188.aspx which tells me tha...

Update without first selecting data in LINQ 2 SQL?

How can you go about updating a record without having to select the data first in LINQ? As you must first perform a linq select (obviously calls a SQL SELECT which is costly), change required properties, then perform SubmitChanges(). I wish to avoid this and just perform a SQL UPDATE, I already know the ID. ...

Linq returns list or single object

I have a Linq to Entities query like this one: var results = from r in entities.MachineRevision where r.Machine.IdMachine == pIdMachine && r.Category == (int)pCategory select r; Usually, I use the code below to check if some results are returned: if (results.Count() > 0) { return new o...

Converting serialized WCF objects back to native objects

I miss the .Net remoting days when I could just send an object over the wire and it would work on both sides of the middle layer without much work. Here's why: I've been given an assignment. I'm building a Logic/Data Abstraction layer (stupid PCI Compliance) so that we can move our database servers off of the corporate network into a pr...

Visual Studio 2008 doesn't recognize Lambda Expression Syntax

Hello, I recently upgraded a Web Application Project (as well as some dependent projects) from .net 2.0 to .net 3.5 using the built in conversion tool. Everything works well such as using MS AJAX 3.5 vs. the external MS AJAX libraries in 2.0. My problem occurs when I tried using the new Lambda Expression syntax. The compiler will not r...

Using a custom URL rewriter, IIS6, and urls with .htm, .html, etc

I have a custom site I'm building with automatic url rewriting using a custom engine. The rewriting works fine as long as the page url doesn't end in somehting like .htm or .html. For these pages it goes directly to the iis 404 page instead of hitting my rewriting engine first. I have the * wildcard handler in the "Home Directory" sec...

How to create Editable forms in XPS document (e.g. PDF forms with Textbox controls)?

I want to create a Editable form having TextBox control, the form should be able to submit to a web service, which will then parse the document. Is this possible with XPS document? ...

How to make two images overlapping with WPF?

I have the following XAML code, which displays a picture (image inside borders) and a logo. Right now, the logo appears below the picture. This is expected, however my goal is to have the logo on top of the picture (precisely at the bottom-right corner). Does someone has an idea how to do that? Do we have layers in WPF? Note: I absolute...

Working with byte arrays in C#

I have a byte array that represents a complete TCP/IP packet. For clarification, the byte array is ordered like this: (IP Header - 20 bytes)(TCP Header - 20 bytes)(Payload - X bytes) I have a Parse function that accepts a byte array and returns a TCPHeader object. It looks like this: TCPHeader Parse( byte[] buffer ); Given the ori...