JS Call()与Apply()
摘要:ECMAScript规范给所有函数都定义了Call()与apply()两个方法,call与apply的第一个参数都是需要调用的函数对象,在函数体内这个参数就是this的值,剩余的参数是需要传递给函数的值,call与apply的不同就是call传的值可以是任意的,而apply传的剩余值必须为数组。例如:function add(a, b) { return a + b; }function sub(a, b) { return a - b; }/*apply用法* var a1 = sub.apply(add, [4, 2]);*var a2= add.apply(sub, [4, 2]); *
阅读全文
序列化与反序列化
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Runtime.Serialization;//using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serializatio
阅读全文