Sends for the fellow dear visitors:welcome to dongpad!


 Welcome to DongPad!

 msn


预览模式: 普通 | 列表

一丝浅笑

This Article is Published by Live Writer。

不要迷恋哥,哥只是个传说...

Tags: DongPad

分类:Life | 固定链接 |评论: 0| 引用: 0 | 查看次数: 416 | 返回顶部

逻辑推理

This Article is Published by Live Writer。

1、你让工人为你工作7天,给工人的回报是一根金条。金条平分成相连的7段
,你必须在每天结束时给他们一段金条,如果只许你两次把金条弄断,你如何给你
的工人付费?
答:把金条从它的一段尾、三段尾弄断,即分成了相连的一段,相连的二段、相连的四段。第一天给工人一段,第二天给工人二段的,要回哪个一段的,第三天再把这个一段的给工人,第四天给工人四段的,要回一段三段的。依次类摊。

2、请把一盒蛋糕切成8份,分给8个人,但蛋糕盒里还必须留有一份。

答:把切成的8份蛋糕先拿出7份分给7人,剩下的1份连蛋糕盒一起分
给第8个人.

3、小明一家过一座桥,过桥时是黑夜,所以必须有灯。现在小明过桥要1秒,
小明的弟弟要3秒,小明的爸爸要6秒,小明的妈妈要8秒,小明的爷爷要12秒。每
次此桥最多可过两人,而过桥的速度依过桥最慢者而定,而且灯在点燃后30秒就会
熄灭。问:小明一家如何过桥?

答:具体到这道题目来说,很多人往往认为应该由小明持灯来来去去,这样最节省时间,但最后却怎么也凑不出解决方案。但是换个思路,我们根据具体情况来决定谁持灯来去,只要稍稍做些变动即可:第一步,小明与弟弟过桥,小明回来,耗时4秒;第二步,小明与爸爸过河,弟弟回来,耗时9秒;第三步,妈妈与爷爷过河,小明回来,耗时13秒;最后,小明与弟弟过河,耗时3秒,总共耗时29秒,多么惊险!

Tags: DongPad

分类:Life | 固定链接 |评论: 0| 引用: 0 | 查看次数: 444 | 返回顶部

string(C# 参考)

This Article is Published by Live Writer。

string 类型表示零或更多 Unicode 字符组成的序列。string 是 .NET Framework 中 String 的别名。

尽管 string 是引用类型,但定义相等运算符(== 和 !=)是为了比较 string 对象(而不是引用)的值。这使得对字符串相等性的测试更为直观。例如:

复制代码
      string a = "hello";
string b = "h";
// Append to contents of 'b'
b += "ello";
Console.WriteLine(a == b);
Console.WriteLine((object)a == (object)b);这将先显示“True”,然后显示“False”,因为字符串的内容是相同的,但是 a 和 b 引用的不是同一个字符串实例。

+ 运算符用于连接字符串:

复制代码
      string a = "good " + "morning";这将创建一个包含“good morning”的字符串对象。

字符串是不可变的,即:字符串对象在创建后,尽管从语法上看您似乎可以更改其内容,但事实上并不可行。例如,编写此代码时,编译器实际上会创建一个新字符串对象来保存新的字符序列,变量 b 继续保存“h”。

复制代码
      string b = "h";
b += "ello";[] 运算符可以用来访问 string 中的各个字符:

复制代码
      string str = "test";
char x = str[2];  // x = 's';字符串为 string 类型并可写成两种形式,即用引号引起来和用 @ 引起来。用引号引起来的字符串括在双引号 (") 内:

复制代码
"good morning"  // a string literal字符串可以包含包括转义序列在内的任何字符:

复制代码
      string a = "\\\u0066\n";上面的字符串包含一个反斜杠、字母 f 和一个新行。

注意 
转义码 \udddd(其中 dddd 是一个四位数)表示 Unicode 字符 U+dddd。此外还识别 8 位 Unicode 转义码:\udddd\udddd。

用 @ 引起来的字符串以 @ 开头,并且也用双引号引起来。例如:

复制代码
@"good morning"  // a string literal用 @ 引起来的优点在于换码序列“不”被处理,这样就可以轻松写出字符串,例如一个完全限定的文件名:

复制代码
@"c:\Docs\Source\a.txt"  // rather than "c:\\Docs\\Source\\a.txt"若要在一个用 @ 引起来的字符串中包括一个双引号,请使用两对双引号:

复制代码
@"""Ahoy!"" cried the captain." // "Ahoy!" cried the captain.@ 符号的另一种用法是使用碰巧成为 C# 关键字的被引用的 (/reference) 标识符。

示例
复制代码
// keyword_string.cs
using System;
class TestClass
{
   static void Main()
   {
      string a = "\u0068ello ";
      string b = "world";
      Console.WriteLine( a + b );
      Console.WriteLine( a + b == "hello world" );
   }
}输出
hello world
True

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 513 | 返回顶部

Remember a few words every day~(6)

This Article is Published by Live Writer。

1.CEIP Customer Experience Improvement Program 客户体验改善计划

2.accessory[æk'sesəri] adj. 附属的(副的,辅助的)n. 附件

Every item shall include a standard complement of accessories and special tools to ensure the normal operation.
为保证设备的正常运转,每个品目都应包括一套标准定额的附件和专用工具。
He is Tom's accessory.
他是汤姆的帮凶。
He asked me to buy him some accessories for a car.
他让我给他买些汽车附件。
 
3.examiner  [ig'zæminə] n. 主考者
I'm a hopeless driver, but the examiner let me through.
我开车的技术糟透了,但考官让我及格了。
I am afraid under the vigilant['vidʒilənt] eyes of the examiner.
在检察员警惕的目光下,我害怕了。
The examiner had to mark 150 SCRIPTs.
主考人须评阅150份试卷.
 
4.vigilant  ['vidʒilənt] adj. 警醒的,警戒著的,警惕的
One must be ever vigilant.
每个人必须随时提高警觉。
The dog kept a vigilant guard over the house.
这只狗警醒地守护着这所房屋。
A vigilant police force helps to control crime.
一支警惕着的警察队伍有助于遏制犯罪
5.particular  [pə'tikjulə] n. 个别项目,详细说明 adj. 特别的,独有的,挑剔的
He gave full particulars of the stolen property.
他详细列出全部被盗的财物。
This work should be done correctly in all particulars.
这项工作每一点都必须做到正确无误。
I'm not particular how you do it as long as it gets done.
只要把它完成了,你怎么做我并不计较
The teacher showed particular concern[kən'sə:n] for the disabled child.老师特别关心那个残疾儿童。
6.concern  [kən'sə:n]n. 关心,关系, 关切的事,忧虑 v. 涉及,与...有关,影响;使关心
This restaurant[ˈrestrɔnt,ˈrestərənt] is a family concern.
这家饭店是由一家人经营的。
These problems concern all of us.
这些问题影响到我们每一个人。
How much money I earn is none of your concern.
我挣多少钱与你无关
 
7.registered trademark  n. 注册商标
Beautiful homes and gardens are trademarks['treidmɑ:k] of the south.美丽的住房和花园是南方的特征
8.aspect  ['æspekt] n. 方面,外貌,外观
I am a beginner in this aspect. 在这方面,我是一个生手
We love the valley in all its aspects.我们爱这山谷的一切。
9.concept  ['kɔnsept] n. 概念,观念
Who originated[ə'ridʒineit]  the concept of stereo sound? 立体声是谁发明的?
 
10.originate  [ə'ridʒineit] v. 开始,发明,发起 [计算机] 起始
The hot dog did not originate in the United States, but in Germany. 热狗不是起源于美国, 而是德国。
The style of architecture originated from the ancient Greeks.这种建筑风格起源于古希腊。

Tags: DongPad

分类:Study | 固定链接 |评论: 0| 引用: 0 | 查看次数: 366 | 返回顶部

x:Name vs. x:Key

This Article is Published by Live Writer。

Question

When should I use x:Key and when should I use x:Name when creating elements?

Answer

It depends on where you create your element.
x:Key is only valid in the scope of a ResourceDictionary element. x:Key is used as the primary identifier for elements in the ResourceDictionary. Specifying x:Name is not considered valid (it will cause an exception when accessing resources).
On the other hand, x:Name is valid in the scope of everything but a ResourceDictionary. x:Key is not valid outside the ResourceDictionary scope.

Btw, lazy for update the blog due to my busy work ,enjoy~~hoho

Tags: DongPad

分类:C# | 固定链接 |评论: 0| 引用: 0 | 查看次数: 427 | 返回顶部