我从Microsoft网站下载了一个聊天示例.我一直在学习几个教程,但是在没有这个c#代码块(@section script {})的脚本之前我从未见过@section脚本{}并且它似乎工作正常但在这个聊天应用程序的实例中使用当我把块外的脚本带到它不起作用时发出信号.
@section scripts {
<!--Script references. -->
<!--The jQuery library is required and is referenced by default in _Layout.cshtml. -->
<!--Reference the SignalR library. -->
<script src="~/Scripts/jquery.signalR-2.2.0.min.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="~/signalr/hubs"></script>
<!--SignalR script to update the chat page and send messages.-->
<script>
$(function () {
// Reference the auto-generated proxy for the hub.
var chat = $.connection.chatHub;
// Create a function that the hub can call back to display messages.
chat.client.addNewMessageToPage = function …Run Code Online (Sandbox Code Playgroud) 我正在尝试调整单元格大小以使其适合使用的文本的最大长度,ClosedXMl.Excel但该单元格给了我以下错误消息:
严重性代码描述项目文件行抑制状态错误 CS0119 'IXLRangeBase.Cells()' 是一种方法,在给定的上下文中无效
C#:
var workbook = new XLWorkbook(); //creates the workbook
var wsDetailedData = workbook.AddWorksheet("data"); //creates the worksheet with sheetname 'data'
wsDetailedData.Cell(1, 1).InsertTable(dataList); //inserts the data to cell A1 including default column name
wsDetailedData.Cells.SizeToContent = true;
workbook.SaveAs(@"C:\data.xlsx"); //saves the workbook
Run Code Online (Sandbox Code Playgroud) 我正在关注本教程,但不确定它是否已过时。
我正在使用@angular/core": "^5.2.0"所以我正在使用这个版本 ngx-infinite-scroll@0.8.3
我已经添加了:
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
并InfiniteScrollModule在 app.module.ts 中导入。
在Search.component.ts我添加了directives: [InfiniteScroll]tp@Component但是当我在“ngx-infinite-scroll”中选择选项卡时它似乎不再存在,我可以看到InfiniteScrollDirective但没有实现它。
我可以让应用程序编译的唯一方法是摆脱directives: [InfiniteScroll]但无限滚动不起作用(它只是一个普通滚动)。
网址:
<div class="search-results"
infiniteScroll
[infiniteScrollDistance]="2"
[infiniteScrollThrottle]="50"
(scrolled)="onScroll()">
<div *ngFor="let name of ['a','a','b','e','r','t','t','e','b','e','r','t','ererer','a','a','b','e','r','t','t','e','b','e','r','t','ererer']">
<div>
{{name}}
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.search-results {
height: 100px;
overflow-y: scroll;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是什么可以无限滚动?
我试图得到所有的Hoop属性,但它只获得第一个值(在这个例子中,它是向列表框中添加24和4).有没有办法将我的所有结果添加到列表中.我通常使用.ToList()但它在这一瞬间不起作用.目的是让Home和客户的篮球分开,然后将它存放到一个物体中.
XML:
<League>
<Round>
<Match>
<Team Side="Home" >
<Hoop qtr="1st" player-name="Joe" time-scored="24" />
<Hoop qtr="1st" player-name="Jack" time-scored="54" />
</Team>
<Team Side="Away">
<Hoop qtr="1st" player-name="James" time-scored="4" />
<Hoop qtr="1st" player-name="Brown" time-scored="34" />
</Team>
</Match>
</Round>
</League>
Run Code Online (Sandbox Code Playgroud)
C#:
XDocument xDoc = XDocument.Load("test.xml");
var query = from q in xDoc.Descendants("Team")
where (string)q.Attribute("Side") == "Home"
let d = q.Element("Hoop")
select new
{
Period = d.Attribute("qtr").Value,
Name = d.Attribute("player-name").Value,
Time = d.Attribute("time-scored").Value
};
foreach (var qq in query)
{
listBox.Items.Add(qq.Time);
}
Run Code Online (Sandbox Code Playgroud) 我想知道是否有简化的方法可以Sub从另一个Sub嵌套的(Sub2)中退出(Sub1);那么,Sub2是在Sub1内部调用的,如果在Sub1中验证失败,我也想退出Sub1吗?
Sub Process()
Validate()
'SomeMorecode...
End Sub
Sub Validate()
'...
'...
End Sub
Run Code Online (Sandbox Code Playgroud)