顯示包含「C#」標籤的文章。顯示所有文章
顯示包含「C#」標籤的文章。顯示所有文章

2017年10月15日星期日

[IIS][記錄用]window.location迷思

放上IIS後window.location的測試,記錄一下

在VS沒有問題到IIS後有問題:
window.location = "/Tentative/TentativeTime"     // localhost:8080/Tentative/TentativeTime , BUT OK IN VIUSAL STUDIO

不同方法測試一下URL怎樣了:
top.location = "/HomePage/Tentative/TentativeTime";  //OK
top.location = "/Tentative/TentativeTime";   //localhost:8080/Tentative/TentativeTime 

2015年8月5日星期三

[C#]使用 "is" 和 "as" Operators的分別

一直都是見別人都是用as, 像是
GameObject myObject = Instantiate(refObject) as GameObject;

然後有天見到有人把 as 寫成 is 我以為他打錯了,誰料翻查下發現原來是有分別的!

長知識了~

以下就是答案:
How to: Safely Cast by Using as and is Operators (C# Programming Guide)

//In general, the as operator is more efficient because it actually returns the cast value if the cast can be made successfully. The is operator returns only a Boolean value//