Using NameSpaces in JavaScript

For those of you still working with the problem of same variable names in JavaScript. Why don't use namespaces on the client, too? On my working library I have added this feature and some namespace-related methods to all my JavaScript files:

<script language="javascript">

var x = new WebApplication1.Class1();
x.FirstName = 'Michael'
x.Description = 'Ajax.NET author';
x.Age = 28;

WebApplication1.WebForm1.SubmitMyClass(x);


</script>

The C# method SubmitMyClass will get a real .NET object. On the client you can create a proxy Class1, fill it and send it, the library (Ajax.NET Professional) will convert it for you. So, you are using the same namespaces like you are using with .NET.

1 Comment

Comments have been disabled for this content.