我看C#大部分人都還沒學會吧!微軟又在研究個新東東了,名字夠怪的,叫Cω,ω是個數學中的符號,MS網站上說是作為C#的一個擴充語言,關於它的文法,第一次看到,讓人看了發暈,不知在寫什麼。
看下面的程式碼片段:
片段1:
using Microsoft.Comega;using System;public class NewsItem{ attribute string title; attribute string author; struct { DateTime date; string body; } public static void Main(){ NewsItem news = <NewsItem title="Hello World" author="Dare Obasanjo"> <date>{DateTime.Now}</date> <body>I am the first post of the New Year.</body> </NewsItem>; Console.WriteLine(news.title + " by " + news.author + " on " + news.date); }}片段2:
foreach (b in bs.book){ yield return <result> {b.title} {b.author} </result>}怎麼樣?暈了吧,居然可以在代碼中直接就寫入XML標籤,並且進行調用,輸出關於它在MSDN中有它的介紹和例子:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml01142005.asp
http://research.microsoft.com/Comega/doc/comega_startpage.htm
現在已經有它的編譯器了,並且安裝後可以整合中VS。NET中進行開發,應用。
Cω編譯器下載頁面:
http://research.microsoft.com/research/downloads/download.aspx?FUID={92E68CF7-BA75-4142-9ED0-25DAED04EFD7}