- .Net Framework通过什么与COM组件进行交互操作?( )
A.Side By Side B.Web Service
C.Interop D.PInvoke
- 以下关于ref和out的描述哪些项是正确的?(多选) ( )
A.使用ref参数,传递到ref参数的参数必须最先初始化。
B.使用out参数,传递到out参数的参数必须最先初始化。
C.使用ref参数,必须将参数作为ref参数显式传递到方法。
D.使用out参数,必须将参数作为out参数显式传递到方法。
- abstract class BaseClass
{
public virtual void MethodA()
{ }
public virtual void MethodB()
{ }
}
class Class1: BaseClass
{
public void MethodA(string arg)
{ }
public override void MethodB()
{ }
}
class Class2: Class1
{
new public void MethodB()
{ }
}
class MainClass
{
public static void Main(string[] args)
{
Class2 o = new Class2();
o.MethodA();
}
}
请问,o.MethodA调用的是: ( )
A.BaseClass.MethodA B.Class2.MethodA
C.Class1.MethodA D.都不是
- 请叙述const与readonly的区别。
const 字段只能在该字段的声明中初始化。readonly 字段可以在声明或构造函数中初始化。因此,根据所使用的构造函数,readonly 字段可能具有不同的值。另外,const 字段是编译时常数,而 readonly 字段可用于运行时。
- Thread和Process之间有什么区别?.NET新引入了Application Domain的概念,这样他们三个之间有什么区别?引入了Application Domain会带来一些潜在的问题么?
- 取得工作区分辨率 ,使用( )
A. Screen.PrimaryScreen.Bounds.Size B.Screen.PrimaryScreen.WorkingArea.Size
C. Application.Screen.Bountds.Size D. Application.Screen.WorkingArea.Size
- 如何在C#中启动IE浏览器
- 根据线程安全的相关知识,分析以下代码,当调用test方法时i>10时是否会引起死锁? 为什么?
public void test(int i)
{
lock(this)
{
if (i>10)
{
i–;
test(i);
}
}
}
- int[][] myArray3=new int[3][]{new int[3]{5,6,2},new int[5]{6,9,7,8,3},new int[2]{3,2}}; myArray3[2][2]的值是( )。
A. 9 B. 2 C. 6 D. 越界
- 在C#中利用Socket进行网络通信编程的一般步骤是:建立Socket侦听、( )、利用Socket接收和发送数据。
A. 建立Socket连接 B. 获得端口号;
C. 获得IP地址; D. 获得主机名;
- 如果设treeView1=new TreeView(),TreeNode node=new TreeNode(“根结点” ),则treeView1.Nodes.Add(node)返回的是一个 ( )类型的值。
A. TreeNode; B. int; C. string; D. TreeView;
- 声明一个委托public delegate int myCallBack(int x); 则用该委托产生的回调方法的原型应该是 ( )
A. void myCallBack(int x) B. int receive(int num)
C. string receive(int x) D. 不确定的
- 下面的代码实现了设计模式中的什么模式
public class A {
private A instance;
private A() {
}
public static A Instance {
get
{
if ( A == null )
A = new A();
return instance;
}
}
}
A. Factory B. Abstract Factory C. Singleton D. Builder
- 如下程序的运行结果是: ( )
public abstract class A
{
public A()
{
Console.WriteLine(’A’);
}
public virtual void Fun()
{
Console.WriteLine(“A.Fun()”);
}
}
public class B: A
{
public B()
{
Console.WriteLine(’B’);
}
public new void Fun()
{
Console.WriteLine(“B.Fun()”);
}
public static void Main()
{
A a = new B();
a.Fun();
}
}
A. A B A.Fun() B. A B B.Fun() C. B A A.Fun() D. B A B.Fun()
- 以下使用了了什么模式
A.Factory B. Command C.Builder D.Decorator
- 你呆在起居室,此时电话铃响了,你起身接电话,电话铃声与下面哪个概念最为类似?接电话与下面哪个概念最为相似?
A 索引器 B 委托 C 事件 D 执行事件处理程序 E 执行异常处理程序
- 有下面的XML文档,请设计一程序段将这个文档读入内存,增加一个作者姓名(author_Name)元素,设增加的姓名为:”Jhon Smith”,然后以XML文档形式保存。
<?xml version=”1.0″ ?>
<books>
<book>
<title>ASP.NET入门经典</title>
<ISBN>1-861005-04-0</ISBN>
<authors>
<author_Name>Chris Ullman</ author_Name >
</authors >
<price RMB=”39.00”/>
</book>
</books>
- 分析以下代码,完成填空
string strTmp = “abcdefg某某某“;
int i= System.Text.Encoding.Default.GetBytes(strTmp).Length;
int j= strTmp.Length;
以上代码执行完后,i= j= - 根据委托(delegate)的知识,请完成以下用户控件中代码片段的填写:
namespace test
{
public delegate void OnDBOperate();
public class UserControlBase : System.Windows.Forms.UserControl
{
public event OnDBOperate OnNew;
private void toolBar_ButtonClick(object sender,ToolBarButtonClickEventArgs e)
{
if(e.Button.Equals(BtnNew))
{
//请在以下补齐代码用来调用OnDBOperate委托签名的OnNew事件。
}
}
}
}