Considering these three options:
Option 1:
sw.WriteLine(subject + ": " + message);
Option 2:
sw.WriteLine("{0}: {1}", subject, message);
Option 3:
sw.Write(subject);
sw.Write(": ");
sw.WriteLine(message);
Answer these questions:
Q1. Which of these choices offers the best performance?
Q2: Can you characterize the memory usage of each of these?
Q3: Which would the performance team generally recommend, and why?
Q4: What special factors might alter this recommendation?
Q5: What did you have do assume about "sw" to answer the question?
从 Eric Gunnerson 的blog 链接过去的,原文在这里。
看之前,自己先想想吧,那家伙的问题后面紧跟着他的答案的说,而我不幸是从后往前看的
。
感觉Q1回答起来应该不算困难。后面几个....
呵呵
昨天去面试的,运气比较好,碰到了一个手很松的VO,准备的材料什么也没有用上,花了几Mins 问了我2个Question 就Pass了。
预计4月初左右去米国,工作地点是在LA,各位朝圣的同志如果有去LA 玩的,也许咱们能碰上。 :)
你们猜这段代码的执行结果是 True Or False?
System.Xml.XmlDocument doc = new XmlDocument();
doc.LoadXml("<root><a/></root>");
System.Xml.XmlNamespaceManager nsm = new XmlNamespaceManager(doc.NameTable);
nsm.AddNamespace("a","DAV");
MessageBox.Show(nsm.HasNamespace("a").ToString());
现在手头的项目,一直没有写用WebDAV的MKCOL 在Exchange 2K里创建Folder的方法,现在要用上了,今天准备补上。
照SDK里的Sample,Create了一个如下的Request:
MKCOL /pub2/folder1/folder2/ HTTP/1.1
Host: hostname
Content-Type: text/xml
Content-Length: XXX
<?xml version="1.0"?>
<g:propertyupdate xmlns:g="DAV:" >
<g:set>
<g:prop>
<g:displayname>value</g:displayname>
</g:prop>
<g:prop>
<f:myprop xmlns:f="urn:schemas-mydomain-tld:">Test</f:myprop>
</g:prop>
</g:set>
</g:propertyupdate>
但是却没有得到预期的Http Status 201 Created,Response Status Code 是 403 Forbidden
研究了半天,才发现原因是不能在MKCOL的时候设置DAV:displayname 属性,顺手换了个属性,改成:
<?xml version="1.0"?>
<a:propertyupdate xmlns:a="DAV:" xmlns:b="urn:schemas:exchange:solutions:MySolution:">
<a:set>
<a:prop>
<b:title>MySolution</b:title>
</a:prop>
</a:set>
</a:propertyupdate>
就OK了。
难道Exchange SDK里的Sample 是没有经过测试的?奇怪的说。
Now, We need use http://202.101.18.235 to visit it.
and, Good luck for
豆腐,希望他明天面试顺利。