一.三种常用的字符串判空串方法: 1: bool isEmpty = (str.Length == 0);
2: bool isEmpty = (str == String.Empty);
3: bool isEmpty = (str == ""); 哪种方法最快? 1. 1
2. 2
3. 3
二.根据线程安全的相关知识,分析以下代码,当调用test方法时i>10时是否会引起死锁?
public void test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
} 1. 会锁死
2. 不会锁死
三.public sealed class SampleSingleton1
{
private int m_Counter = 0;
private SampleSingleton1()
{
Console.WriteLine(""初始化SampleSingleton1。"");
}public static readonly SampleSingleton1 Singleton = new SampleSingleton1();public void Counter()
{
m_Counter ++;
}
}
以上代码实现了设计模式中的哪种模式? 1. 原型
2. 抽象工厂
3. 单键
4. 生成器
2: bool isEmpty = (str == String.Empty);
3: bool isEmpty = (str == ""); 哪种方法最快? 1. 1
2. 2
3. 3
二.根据线程安全的相关知识,分析以下代码,当调用test方法时i>10时是否会引起死锁?
public void test(int i)
{
lock(this)
{
if (i>10)
{
i--;
test(i);
}
}
} 1. 会锁死
2. 不会锁死
三.public sealed class SampleSingleton1
{
private int m_Counter = 0;
private SampleSingleton1()
{
Console.WriteLine(""初始化SampleSingleton1。"");
}public static readonly SampleSingleton1 Singleton = new SampleSingleton1();public void Counter()
{
m_Counter ++;
}
}
以上代码实现了设计模式中的哪种模式? 1. 原型
2. 抽象工厂
3. 单键
4. 生成器
我正郁闷.net多线程的取消按扭呢!
呵呵。。还真不知道究竟哪个快。。
昨天在黄龙大酒店现场笔试,前20名有米拿,可惜刚好开会,去不了,郁闷
get_Lenth
Int.Equals//两步完工2、3、
String.op_equals
String,Equals
Steing._length
Int.Equals
2 2 int here will not dead lock.If it's a object,dead lock will happen.
3 3 Singleton Pattern
我觉得这个解释不对,有人能解释一下为什么2不会死锁吗?