日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

剖析ASP.NET AJAX的面向?qū)ο笏枷?3)_.Net教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:ASP.NET緩存:方法分析和實(shí)踐示例
盡早緩存;經(jīng)常緩存 您應(yīng)該在應(yīng)用程序的每一層都實(shí)現(xiàn)緩存。向數(shù)據(jù)層、業(yè)務(wù)邏輯層、UI 或輸出層添加緩存支持。內(nèi)存現(xiàn)在非常便宜 — 因此,通過以智能的方式在整個(gè)應(yīng)用程序中實(shí)現(xiàn)緩存,可以

Inheritance.js腳本文件中定義了兩個(gè)類:Person和Employee,Employee是從Person繼承而來。每個(gè)類都有字段、公共屬性和方法。另外,Employee類重寫了toString的實(shí)現(xiàn),并在重寫的代碼中調(diào)用了基類的功能。在這個(gè)例子中把類Person的名字空間設(shè)定為"Demo"。運(yùn)行頁面Inheritance.aspx,點(diǎn)擊“創(chuàng)建對(duì)象”、“對(duì)象釋放”、“公共和私有屬性”、“對(duì)象方法”、“重寫方法”,“對(duì)象類型檢查”體驗(yàn)一下。

4.接口

接口是類要實(shí)現(xiàn)的邏輯協(xié)議,是對(duì)類進(jìn)行集成的公共遵守的規(guī)范。它能使多個(gè)類和同一個(gè)接口把實(shí)現(xiàn)定義和類的具體實(shí)現(xiàn)結(jié)合起來。下面的例子定義了一個(gè)基類Tree和接口IFruitTree,Apple和Banana這兩個(gè)類實(shí)現(xiàn)了接口IFruitTree,但Pine類沒有實(shí)現(xiàn)接口IFruitTree。

Type.registerNamespace("Demo.Trees");

  Demo.Trees.IFruitTree = function() {}

  Demo.Trees.IFruitTree.Prototype = {

  bearFruit: function(){}

  }

  Demo.Trees.IFruitTree.registerInterface('Demo.Trees.IFruitTree');

  Demo.Trees.Tree = function(name) {

  this._name = name;

  }

  Demo.Trees.Tree.prototype = {

  returnName: function() {

  return this._name;

  },

  toStringCustom: function() {

  return this.returnName();

  },

  makeLeaves: function() {}

  }

  Demo.Trees.Tree.registerClass('Demo.Trees.Tree');

  Demo.Trees.FruitTree = function(name, description) {

  Demo.Trees.FruitTree.initializeBase(this, [name]);

  this._description = description;

  }

  Demo.Trees.FruitTree.prototype.bearFruit = function() {

  return this._description;

  }

  Demo.Trees.FruitTree.registerClass('Demo.Trees.FruitTree', Demo.Trees.Tree, Demo.Trees.IFruitTree);

  Demo.Trees.Apple = function() {

  Demo.Trees.Apple.initializeBase(this, ['Apple', 'red and crunchy']);

  }

  Demo.Trees.Apple.prototype = {

  makeLeaves: function() {

  alert('Medium-sized and desiduous');

  },

  toStringCustom: function() {

  return 'FruitTree ' Demo.Trees.Apple.callBaseMethod(this, 'toStringCustom');

  }

  }

  Demo.Trees.Apple.registerClass('Demo.Trees.Apple', Demo.Trees.FruitTree);

  Demo.Trees.GrannySmith = function() {

  Demo.Trees.GrannySmith.initializeBase(this);

  // You must set the _description feild after initializeBase

  // or you will get the base value.

  this._description = 'green and sour';

  }

  Demo.Trees.GrannySmith.prototype.toStringCustom = function() {

  return Demo.Trees.GrannySmith.callBaseMethod(this, 'toStringCustom') ' ... its GrannySmith!';

  }

  Demo.Trees.GrannySmith.registerClass('Demo.Trees.GrannySmith', Demo.Trees.Apple);

  Demo.Trees.Banana = function(description) {

  Demo.Trees.Banana.initializeBase(this, ['Banana', 'yellow and squishy']);

  }

  Demo.Trees.Banana.prototype.makeLeaves = function() {

  alert('Big and green');

  }

  Demo.Trees.Banana.registerClass('Demo.Trees.Banana', Demo.Trees.FruitTree);

  Demo.Trees.Pine = function() {

  Demo.Trees.Pine.initializeBase(this, ['Pine']);

  }

  Demo.Trees.Pine.prototype.makeLeaves = function() {

  alert('Needles in clusters');

  }

  Demo.Trees.Pine.registerClass('Demo.Trees.Pine', Demo.Trees.Tree);

Interface.js腳本文件中定義了一個(gè)Tree基類和一個(gè)IFruitTree接口。Apple和Banana兩個(gè)繼承類實(shí)現(xiàn)了IFruitTree接口,而Pine類沒有實(shí)現(xiàn)IFruitTree接口。運(yùn)行Interface.aspx,點(diǎn)擊“對(duì)象創(chuàng)建”、“接口檢查”、“調(diào)用接口方法”體驗(yàn)一下。

5.枚舉

枚舉是包含一組被命名的正整數(shù)常數(shù)的類。你可以像訪問屬性一樣訪問它的值。例如:

myObject.color = myColorEnum.red,枚舉提供了一種很容易理解的整數(shù)表示。下面的例子定義了一個(gè)以十六進(jìn)制數(shù)表示的顏色被命名為有意義的名字的枚舉類型。

運(yùn)行Enumeration.aspx,選擇下拉框中的顏色,腳本程序把背景色設(shè)為選中的枚舉類型Demo.Color中的顏色。

  6.反射

  反射用于檢查一個(gè)運(yùn)行期程序的結(jié)構(gòu)和組成,是通過類Type的API來實(shí)現(xiàn)反射的,這些方法使你能夠收集一個(gè)對(duì)象的信息,例如:它是繼承于哪個(gè)類、它是否實(shí)現(xiàn)類某個(gè)特指的接口、它是否是某個(gè)類的實(shí)例等。

  下面的例子用反射的API測試GrannySmith類是否實(shí)現(xiàn)了前面的接口。運(yùn)行Reflection.aspx,點(diǎn)擊“檢查類型”、“檢查繼承”、“檢查接口”體驗(yàn)一下。

  另外需要說明的一點(diǎn)是,Microsoft AJAX Library是基于開放體系架構(gòu)而開發(fā)的,不僅僅用于asp.net,還能用于其它體系架構(gòu)中,例如用在java中。

分享:Asp.Net中動(dòng)態(tài)頁面轉(zhuǎn)靜態(tài)頁面
關(guān)于在Asp.Net中動(dòng)態(tài)頁面轉(zhuǎn)靜態(tài)頁面的方法網(wǎng)上比較多。結(jié)合實(shí)際的需求,我在網(wǎng)上找了一些源代碼,并作修改�,F(xiàn)在把修改后的代碼以及說明寫一下。 一個(gè)是一個(gè)頁面轉(zhuǎn)換的類,該類通過靜態(tài)函數(shù)Ch

共3頁上一頁123下一頁
來源:模板無憂//所屬分類:.Net教程/更新時(shí)間:2008-08-22
相關(guān).Net教程