ASP.NET AJAX Client Library Question And Answer Series – Question 3 (How do you create static members and methods on an object in asp.net ajax?)
Question: How do you create static members and methods on an object in asp.net ajax?
Members can be defined as attributes (fields) and methods in the context of oo programming. So, in order to effectively answer the question, I need to illustrate how to create a public static field and method. Take a look at the following Person (ASP.NET AJAX) class:
Notice the species static field and the showSpecies static method. In the code below, you can see where we are calling the static method and accessing the static field.
So, not only can we create static members for our own objects, we can extend any object.
Have a question to add to the list? Email me at email@example.com.