asp.net(C#)关于委托方面的难题?????? datagrid的pageindexchanged事件是怎么搞的........ 报错: 老是提示说page下找不pageindexchanged事件.....是怎么回事????? 可否提供几本关于委托方面的书和资料让小弟学习学习,小弟感激不尽!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 委托是C#中的一种引用类型,类似于C/C++中的函数指针。与函数指针不同的是,委托是面向对象、类型安全的,而且委托可以引用静态方法和实例方法,而函数指针只能引用静态函数。委托主要用于 .NET Framework 中的事件处理程序和回调函数。一个委托可以看作一个特殊的类,因而它的定义可以像常规类一样放在同样的位置。与其他类一样,委托必须先定义以后,再实例化。与类不同的是,实例化的委托没有与之相应的术语(类的实例化称作对象),作为区分我们将实例化的委托称为委托实例。去网上找一下吧..有你想了解的概念问题 vs.net的帮助索引里面也好像这么说!!!(小弟爱说老实话!) 本来就是COPY那上面的....难道一些理论上的东西我还自己写出来吧.那样我可以到微软写开发文档去了。呵呵。 一个简单的委托例子:using System;public class SamplesDelegate{ //定义一个委托类型的_____类 public delegate String myMethodDelegate(int myInt); public class mySampleClass { public String myStringMethod ( int myInt ) { if ( myInt > 0 ) return( "positive" ); if ( myInt < 0 ) return( "negative" ); return ( "zero" ); } public static String myStaticStringMethod ( int myInt ) { if ( myInt > 0 ) return( "+" ); if ( myInt < 0 ) return( "-" ); return ( "" ); } } public static void Main() { mySampleClass mySC = new mySampleClass(); myMethodDelegate StringMethod = new myMethodDelegate( mySC.myStringMethod ); myMethodDelegate StaticMethod = new myMethodDelegate( mySampleClass.myStaticStringMethod ); Console.WriteLine( "{0} is {1}; use the sign \"{2}\".", 5, StringMethod( 5 ), StaticMethod( 5 ) ); Console.WriteLine( "{0} is {1}; use the sign \"{2}\".", -3, StringMethod( -3 ), StaticMethod( -3 ) ); Console.WriteLine( "{0} is {1}; use the sign \"{2}\".", 0, StringMethod( 0 ), StaticMethod( 0 ) ); Console.ReadLine(); }} 你自己写的datagrid控件么?为什么会找不到事件? datagrid的属性onpageindexchanged="(your function name)" 在private void InitializeComponent() { //这里加上事件声明 } http://community.csdn.net/Expert/topic/3168/3168824.xml?temp=.8241693 求一正则, 取出字符中红色部分 如何防止sql注入 web打印问题..谁有web打印代码??? 带master使用.net ajax一点问题. gridView 在 数据绑定时 获取行的状态为 ListItemType.EditItem 怎么获取啊 有没有较简单的不用HtmlInputFile控件上传的办法 200分,求教VS2003打包若干问题! ASP.NET连接SQL SERVER 存储过程,并传递参数,返回表格。 问ajaxpro的一个获取值的小问题 你是用那种开发工具开发asp.net?? 关于换行问题,急啊! CrytalReport问题,打开子报表时候报错:索引超出了数组界限?
using System;
public class SamplesDelegate
{
//定义一个委托类型的_____类
public delegate String myMethodDelegate(int myInt);
public class mySampleClass
{
public String myStringMethod ( int myInt )
{
if ( myInt > 0 )
return( "positive" );
if ( myInt < 0 )
return( "negative" );
return ( "zero" );
}
public static String myStaticStringMethod ( int myInt )
{
if ( myInt > 0 )
return( "+" );
if ( myInt < 0 )
return( "-" );
return ( "" );
}
}
public static void Main()
{
mySampleClass mySC = new mySampleClass();
myMethodDelegate StringMethod = new myMethodDelegate( mySC.myStringMethod );
myMethodDelegate StaticMethod = new myMethodDelegate( mySampleClass.myStaticStringMethod );
Console.WriteLine( "{0} is {1}; use the sign \"{2}\".", 5, StringMethod( 5 ), StaticMethod( 5 ) );
Console.WriteLine( "{0} is {1}; use the sign \"{2}\".", -3, StringMethod( -3 ), StaticMethod( -3 ) );
Console.WriteLine( "{0} is {1}; use the sign \"{2}\".", 0, StringMethod( 0 ), StaticMethod( 0 ) );
Console.ReadLine();
}
}
private void InitializeComponent()
{
//这里加上事件声明 }