全文预览

Framework综合题目答案

上传者:相惜 |  格式:doc  |  页数:6 |  大小:60KB

文档介绍
getAge() Р C) void showname()Р D) static int getNamelength(string name)Р答案:ACР(签名应一致,P150)Р类MyClass的静态事件MouseClicked为MouseClickedEventListener类型。obj为另一个类OthersClass的实例;请问如何将obj.DoSomething( )方法从事件MouseClicked的调用列表中移除?()РMyClass.MouseClicked -= obj.DoSomething;РMyClass.MouseClicked.Remove(newРMouseClickedEventListener(obi.DoSomething));РMyClass.MouseClicked.Remove(obj.DoSomething);РMyClass.MouseClicked -= new MouseClickedEventListenerР(obi.DoSomething) 答案:DР类MyClass中事件MouseClicked定义如下:Рpublic static event MouseClickedListener MouseClicked;Р如何将对象Form1的方法DrawForm关联到该事件?( )РMyClass.MouseClicked += Form1.DrawForm;РMyClass.MouseClicked.Add(new MouseClickedListener(Form1.DrawForm));РMyClass.MouseClicked.Add(Form1.DrawForm);РMyClass.MouseClicked += new MouseClickedListenerР(Form1.DrawForm)); 答案:D

收藏

分享

举报
下载此文档