Thursday, April 3rd, 2008
JavaScript, C#, and ExtSharp
Colin Ramsay thinks that JavaScript and C# can be scarily similar as he shows an ExtJS example:
-
-
var win = new Ext.Window({
-
title: 'Order Viewer', layout: 'border',
-
width: 500, height: 500,
-
modal: true, resizable: false, closable: false, draggable: false,
-
items: [ frm, lst ]
-
});
-
-
win.on('render', function() {
-
load(5);
-
});
-
-
win.show();
-
This works well for ExtJS since it is written in a style that leads itself to this similarity. Colin also points out ExtSharp, a project that lets you write your Ext application in C#:
I really love Ext but coding in javascript just gives me the chills. So I went out and found a way to use my favorite js library (Ext) and my favorite programming language (C#) at the same time. By using a project called Script# I am able to write C# code and have it converted into javascript, similar to GWT. Building on that, Script# also allows you to code against external APIs, but you need to create the types, methods, properties, etc. for everything in the javascript library. So what I did was write a little console app that parses all of the ExtJS source files extracting out the script comments and writing C# files for each class. The end result is a programmable C# API to access all of the Ext objects and I threw in a couple new things to make life a little easier.












I think that ExtJS took some heavy inspiration from the design of Windows Forms so this shouldn’t be a big surprise ;-).
Thanks. Good article.
Interesting Article, thanks Armenian Genocide , great information and research.