我看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}