我有一个LINQ查询如下:
Dim CustQuery = From a In db.Customers
Where a.GroupId = sendmessage.GroupId
Select a.CustCellphone
Run Code Online (Sandbox Code Playgroud)
并希望通过每个结果并获得手机号码来做一些代码.我尝试了以下但似乎无法使其正确:
For Each CustQuery.ToString()
...
Next
Run Code Online (Sandbox Code Playgroud)
那么我的问题是我该怎么做?
我想在我的HTML中做这样的事情:
@foreach (var item in Model) {
Run Code Online (Sandbox Code Playgroud)
然而,不是每个条目都这样做,我只想要模型中的前6个项目.有谁知道语法?尝试了一些没有成功的人.
以下代码部分按我的意愿工作
for (int i = 1; i <= practicehistory.TotalNumQuestions; i++)
{
query = from a in db.Questions
where a.CategoryId == practicehistory.CategoryId
orderby a.QuestionId
select a;
randomNumber = random.Next(1, count + 1);
int qNum = query.Skip(randomNumber - 1).First().QuestionId;
asked.QuestionId = qNum;
asked.OrderAsked = i;
db.AskedHistories.Add(asked);
db.SaveChanges();
}
Run Code Online (Sandbox Code Playgroud)
但是,我偶尔会遇到随机数与之前的for循环运行中的随机数相同的情况.我想知道是否有人有一个优雅的解决方案,我怎么能确保只生成一个比以前没有生成过的随机数?我正在考虑填充一个数组并检查它,但这似乎是多余的!
在 ListItem 的 React Native Elements 文档(https://react-native-training.github.io/react-native-elements/docs/listitem.html#linear-gradient-scale-feedback)中,ListItem 的按钮之间有填充它们是圆形的。
但是,当我尝试执行以下操作(直接来自文档)时,它不会产生相同的样式:
<ListItem
Component={TouchableScale}
friction={90} //
tension={100} // These props are passed to the parent component (here TouchableScale)
activeScale={0.95} //
linearGradientProps={{
colors: ['#FF9800', '#F44336'],
start: [1, 0],
end: [0.2, 0],
}}
ViewComponent={LinearGradient} // Only if no expo
leftAvatar={{ rounded: true, source: { uri: avatar_url } }}
title="Chris Jackson"
titleStyle={{ color: 'white', fontWeight: 'bold' }}
subtitleStyle={{ color: 'white' }}
subtitle="Vice Chairman"
chevronColor="white"
chevron
/>
Run Code Online (Sandbox Code Playgroud)
此外,我尝试添加垫和分隔道具,但这不会产生正确的外观。
如何设计单个 ListItem 组件的样式以匹配此样式?