[ASP. NET Ajax] JavaScript extensions similar to the. NET Framework

Source: Internet
Author: User

Recently, Ajax has become popular all over the world. In communityserver, he used his own-defined encapsulated JS, and cross-browser it can be used in small applications.ProgramAnd is easy to use. However, I still don't know Microsoft Ajax at all. From today on, I will start to learn about Microsoft Ajax. I also read someArticleBut most of them are about ajaxextendcontrol. I want to start with the script to learn about Microsoft Ajax and review the script again by the way. From the original file, we can see that Microsoft Asp.net Ajax is a very powerful script library that is suitable for C # developers to expand. Added a type and system in the Microsoft Asp.net Ajax script library to expand JavaScript objects. The extension form is similar. namespaces, abstract classes (inheritance), interfaces (interfaces ), enumerations and object reflection are also extended to (string) strings and (array) arrays. This allows our. NET developers, especially C # developers, to better and more effectively expand scripts.

To encapsulate common Javascript into a similar one. net Framework, type can be said to be indispensable, through some methods in the type can register our script to a class, register a class to a namespace and so on. Next we will introduce the previous Microsoft Ajax script libraries similar to the. NET Framework one by one.

1. namespaces

Is a logical classification (Personal fiction, if there are similar is purely coincidence), many classes (classes) for classification in a timely manner, through the type. the registernamesapce method can call a class (called a "class"). Although it is not similar, let's give it a general explanation !) Register with a namespace.

2. Classes

Reference type. All classes inherit from JavaScript objects (all classes in. Net also inherit from objects) and register an object to the class through type. registerclass. Because an object-oriented model is applied, object instances that inherit the base class can also be implemented in the Microsoft Ajax script library. A class can contain four members: fields, properties, methods, and events.

Fields: You can use the Instance Object of the current class to reference such as myclass. Name = "myname ";

Properties: You can pay a value for a method with the get and set tags. In Asp.net Ajax, you can combine "GET _" and "SET _" with the method name to pay the value for it, if you want to pay for a property named myname, you can use the get_myname and set_myname methods to complete this task.

Methods: methods are functions.

Events: events mainly involve behavior actions. When an event is suspended (activated), one or more methods inherited from handlers are called to process the event.

3. Inheritances

As we all know, virtual functions are to be rewritten, and most object-oriented FunctionsProgramming LanguageBoth support class inheritance and rewriting, but JavaScript does not support this function. However, in Asp.net Ajax, a special method is used (Methods starting with "_" will be treated as private methods and cannot be executed in external classes) with this rewrite function, the script library will be better expanded.

4. Inheritances

Each class can inherit from another base class. When a class inherits the base class, this class will load methods, attributes, events, and so on in the base class, and can also override methods in the base class, events, or directly calling methods in the base class, Asp. net Ajax also implements this function.

5. Interfaces

There is no implementation method for an interface knowledge Convention. There is also an interface in ASP. NET Ajax, which is actually an empty function.

6. enumerations

You can use the type. registerenum method to register an enumeration, which is used to express an object more intuitively.

7. Reflection

You can use reflection to know the information in the class, expand the type, and provide APIs to analyze the class to obtain the information in the class.

Today, I first have a general understanding of JavaScript Microsoft Ajax Library (I prefer to call it a Microsoft Ajax script library). The first touch of this thing may be unreasonable in many ways, A process is always required if people do not understand it. Just like how I did not understand the class (because I did my research without guidance, biological engineering is one of the top ten deceptive majors in China, because I didn't notice that my graduation certificate is still sent to school ?), I hope I can understand Ajax step by step. If something is wrong, please criticize and advise.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.