Can't return anonymous type from method? Really?
One of the new features introduced in C# 3.0 which will be available in Visual Studio "Orcas" (currently in CTP version) is anonymous type. Anonymous type is something very similar to tuple type from Cω [1] (which is based on tuple types known from many functional programming languages including F#). Anonymous types are extremely useful in LINQ queries, because it allows you to construct type with several properties without declaring the type (with all the properties). Example of query with anonymous type looks like this:
var q = from c in db.Customers
where c.Country = "Czech Republic"
select new { FullName=c.Name+" "+c.Surname, Address=c.Address };
Ok, it's probabbly not the best example, but it demonstrates the point - you want to return some information from query
and you don't need to declare type that contains FullName
and Address
properties before, because
you need it only for this single query (and you want to return only these two fields, so you don't transfer additional
data that you don't need from database).
Now let's get to the second point...
Published: Tuesday, 23 January 2007, 11:54 PM
Tags:
c#
Read the complete article
Phalanger has a new website!
As you may know, I became new project lead for the Phalanger project [^]. Phalanger was started as a project at Charles University (where I'm studying) by Tomas Matousek, Ladislav Prosek and 4 other guys, the first version was very successful and they started wokring on the second version which introduces PHP in the family of first-class .NET languages (which makes it fully interoperable with the rest of .NET world). After releasing the second version, Tomas and Ladislav moved to Microsoft and convinced me to continue in the Phalanger development. Most of the work on the 2.0 version was already done, so we're currently working on implementing the rest of the PHP/CLR language extensions, making Phalanger more compatible with existing PHP apps and so on. For more information about the history of Phalanger visit the project history page [^].
I think that Phalanger is in the phase when it can be very interesting for both PHP and .NET communities, but it never got greater publicity and there are not very much examples and articles to demonstrate the interesting Phalanger features. To improve this we started working on the new Phalanger website where users could share their experiences, tips etc. We used PHP wiki called DokuWiki [^] (running, of course on Phalanger) and you can find the new website here:
- Phalanger - Homepage [^] (the new project homepage)
- Phalanger - User wiki [^] (you can edit pages in user wiki after logging in)
I also wrote two articles about Phalanger (and I'm working on more :-)) to explain the most important and interesting Phalanger features and concepts. You can find the articles at our web:
- Phalanger for .NET developers [^] - focused on .NET interoperability and features interesting for C# developers
- Phalanger for Mono users [^] - Phalanger 2.0 supports Mono, so here is an introduction for Mono users
I'll also continue blogging about Phalanger, so you can expect more information about Phalanger, problems that we're currently solving as well as some other tips, tricks in this blog. If you're interested only in Phalanger you can use this RSS feed to monitor new articles in this blog (it shows only articles with the Phalanger tag).
Published: Sunday, 14 January 2007, 12:49 AM
Tags:
phalanger, mono
Read the complete article