我使用Angular 4(4.3.0)创建了一个简单的Hello world应用程序.
角度文件:
- app.component.ts
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
myTitle:string;
constructor() {
this.myTitle = `Hello world`;
}
}
Run Code Online (Sandbox Code Playgroud)
- app.component.html
<h1>
{{myTitle}}
</h1>
Run Code Online (Sandbox Code Playgroud)
- app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
TypeScript文件
{
"compileOnSave": false,
"compilerOptions": {
"outDir": …Run Code Online (Sandbox Code Playgroud) 关于这个问题有很多问题,但没有一个(除了一个,但仍然是一个短的)正在处理以下场景.
来自C#4书:

马克还写道:
如果更改const的值,则需要重建所有客户端
题 :
1)为什么?是static readonly和const- static?
2)实际值保存在哪里?
3)如何使一个领域static readonly实际上solve这个问题"落后于现场"?
我怎样才能转换ä...成类似的东西 \u0131...?
这样做有什么功能吗?
ps:
在这旁边:[对不起@Kendall Frey :-)]
char a = 'ä';
string escape = "\\u" + ((int)a).ToString("X").PadLeft(4, '0');
Run Code Online (Sandbox Code Playgroud) 例如,关于Single Responsibility原则:
我们来谈谈一Radio堂课:

有人可能会说,Radio班级有两个职责,即音量和电台管理.这些操作将使用它从客户端的完全不同的区域调用.
因此我们有这个:

一切都很好.
但我总是看到这样的句子:
所以现在,当我们需要改变,这取决于损坏的元件上的所有代码并不甚至需要重新编译.
等一下 !
如果我需要更改VolumeManager 类 - 我将不必重新编译Radio和StationManager.
但是我必须停止(在web中)iis以便应用程序使用新的DLL,它将导致应用程序关闭.
此外,在console,我将不得不终止整个程序,以便更改dll,因为它被进程锁定(你不能在应用程序运行时更改DLL - 文件被锁定)
即使我将使用GAC - 我将不得不停止该程序,以便使用dll.
那么它能拯救我什么?编译就是 - 右键单击并构建.就这样
我没有看到提到的好处:" 你只需要编译破碎的类...... "
我错过了什么?
http://www.gontu.org/solid-single-responsibility-principle/寻找单词" build"
http://epic.tesio.it/doc/manual/solid_principles.html寻找单词" recompiled"
http://www.dananhudson.com/?tag=solid寻找单词" recompile"
相关简介信息:
AFAIK,并发堆栈,队列和包类在内部使用链接列表实现.
而且我知道争用少得多,因为每个线程都负责自己的链表.无论如何,我的问题是关于ConcurrentDictionary<,>
但我正在测试这段代码:(单线程)
Stopwatch sw = new Stopwatch();
sw.Start();
var d = new ConcurrentDictionary < int, int > ();
for(int i = 0; i < 1000000; i++) d[i] = 123;
for(int i = 1000000; i < 2000000; i++) d[i] = 123;
for(int i = 2000000; i < 3000000; i++) d[i] = 123;
Console.WriteLine("baseline = " + sw.Elapsed);
sw.Restart();
var d2 = new Dictionary < int, int > ();
for(int i = 0; i < 1000000; i++) lock (d2) …Run Code Online (Sandbox Code Playgroud) 我有一个包含层次结构数据的表 - 类似于:
childID | parentID
____________________
1 | 5
5 | 9
9 | 20
2 | 4
3 | 7
7 | 8
8 | 8
20 | 20
4 | 4
8 | 8
Run Code Online (Sandbox Code Playgroud)
期望的输出:

我创建了一个递归CTE,它找到了我的顶部fatherID.
就像是:
;WITH cte AS (
SELECT a.childID
,a.parentID
,1 AS lvl
FROM [Agent_Agents] a
WHERE a.childID = 214 //<==== value to begin with !! - thats part the problem
UNION ALL
SELECT tmp.childID
,tmp.parentID
,cte.lvl+1
FROM [Agent_Agents] tmp
INNER …Run Code Online (Sandbox Code Playgroud) 从来没有遇到过这个问题,也不知道为什么.唯一的解释是范围问题.
在同一页面中,我有两节JS:
...
<script type="text/javascript">
go();
</script>
<script type="text/javascript">
function go()
{ alert(''); }
</script>
...
Run Code Online (Sandbox Code Playgroud)
这将显示错误:未定义go
哪里
...
<script type="text/javascript">
go();
function go()
{ alert(''); }
</script>
...
Run Code Online (Sandbox Code Playgroud)
正在工作(显然).
<script>标签是否创建了JS的范围?救命 ?
看完这个问题后,我需要澄清一些事情.
IQueryable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
IEnumerable<Customer> custs = from c in db.Customers
where c.City == "<City>"
select c;
Run Code Online (Sandbox Code Playgroud)
问题:
1)可以这么说:在第一个查询中,SQLServer正在运行整个操作,包括where子句,只返回相关的行 - 而第二个查询SELECT *...并将所有 行返回 到C#和THEN过滤器?
2)如果我只有一个集合 - 在记忆中怎么样?(var lstMyPerson = new List<MyPerson>())
IQueryable<MyPerson> lst = from c in lstMyPerson
where c.City == "<City>"
select c;
Run Code Online (Sandbox Code Playgroud)
VS
IEnumerable<MyPerson> custs = from c in lstMyPerson
where c.City == "<City>"
select c; …Run Code Online (Sandbox Code Playgroud) é是一封严肃的口音.é也可以用́ + e = é.来表示.
但是,我想知道我是否可以组合任何unicode字符?
例如:
我正在寻找一个圈内问号的unicode代码点,就像在这里(图片):
但我找不到任何东西.(我看了这里)
所以我想知道我是否可以将这两者结合起来:
?和?(这是◯-在过程的更大的尺寸).
?常见问号char(?)在哪里,并且?是◯大圆圈 - 几何形状.
是否可以在C#中这样做?



我读过:
团队一直忙于实现初始化程序的其他变体.例如,您现在可以初始化Dictionary对象
但看看:
var Dic = new Dictionary<string,int>{ {"x",3}, {"y",7} };
Run Code Online (Sandbox Code Playgroud)
VS
var Dic = new Dictionary<string,int>{ ["x"]=3, ["y"]=7 };
Run Code Online (Sandbox Code Playgroud)
我不知道好处在哪里.它看起来一样.两者都只是一个名值集合.
他们用成对的方括号和一些逗号交换成对的花括号
题:
使用新语法的附加值是什么?一个现实世界的例子将非常感激.
c# ×7
.net ×4
javascript ×2
.net-4.0 ×1
angular ×1
c#-6.0 ×1
compilation ×1
const ×1
dictionary ×1
ienumerable ×1
iqueryable ×1
readonly ×1
sql-server ×1
static ×1
string ×1
t-sql ×1
unicode ×1
webpack ×1