我想检查对象是否不是特定类型.我知道如何检查,如果事情是一个特定类型的:
if (t is TypeA)
{
...
}
Run Code Online (Sandbox Code Playgroud)
但
if (t isnt TypeA)
{
...
}
Run Code Online (Sandbox Code Playgroud)
不起作用.
我有以下表格.
Table Name: Recipe
id topic description difficultylevel totaltime
1 Cheese Cheese Easy 10
2 Cheese1 Cheese1 Medium 50
Table Name: Ingredients
id recipeid ingredient
1 1 Butter
2 1 Cheese
3 1 Bread
Run Code Online (Sandbox Code Playgroud)
现在,当我运行以下查询时,它返回配方id ="1",即使它不应该,因为我不想要一个含有黄油的配方.
SELECT recipe.id
FROM
`recipe`
INNER JOIN ingredients ON recipe.id = ingredients.recipeid
WHERE
(recipe.description LIKE '%CHEESE%' OR recipe.topic LIKE '%CHEESE%')
AND (recipe.difficultylevel='Easy')
AND (recipe.totaltime <= 30)
AND (ingredients.ingredient <> 'Butter')
Run Code Online (Sandbox Code Playgroud)
由于奶酪和面包,它会两次返回recipe.id ="1".我需要修复查询,以便它排除recipe.id ="1",如果它有黄油(例如)
我是正则表达式的新手。我有一个像下面这样的字符串。我想获取 [{# #}] 之间的值
前任:"Employee name is [{#John#}], works for [{#ABC Bank#}], [{#Houston#}]"
我想从上面的字符串中获取以下值。
"John",
"ABC Bank",
"Houston"
Run Code Online (Sandbox Code Playgroud) 我正在使用kendo-ui上传,我想过滤文件(只允许选择.jpg,.png),但是我不知道要在javascript中实现,请帮帮我!
1- .cshtml文件
<input name="files" id="files" type="file" />
2- JavaScript
$(document).ready(function () {
$("#files").kendoUpload({
multiple: false,
async: {
saveUrl: "Home/Save"
}
});
});
Run Code Online (Sandbox Code Playgroud) 我有这样的类声明:
internal private abstract class BoxGroup<TS> : IBoxGroup where TS : SavedState
Run Code Online (Sandbox Code Playgroud)
在那个班级我有这个方法:
protected virtual TS saveState() {
return new SavedState(Width, Height);
}
Run Code Online (Sandbox Code Playgroud)
我认为这是正确的,但我在返回语句下看到红线,Resharper说new SavedState(Width, Height)无法转换为TS.我不知道为什么.我认为这TS可以是任何扩展的类,SavedState但也可以SavedState.我该怎么做才能纠正它?
类保存状态非常简单,如下所示:
private class SavedState {
internal float Width { get; private set; }
internal float Height { get; private set; }
public SavedState(float width, float height) {
Width = width;
Height = height;
}
}
Run Code Online (Sandbox Code Playgroud) 我每个月收到一份声明(如.xls),其中列出了一组具有关联日期的可计费项目.我想创建一个公式(使用=sum()或=sumifs()与总的计费项目,但只有那些落在周一至周五(即不是周末).这可能吗?
A B
------+--------------+-------------
1 | 05/12/2016 | $10.00
2 | 06/12/2016 | $10.00
3 | 07/12/2016 | $10.00
4 | 08/12/2016 | $10.00 dates are formatted as
5 | 09/12/2016 | $10.00 dd/mm/yyyy
6 | 10/12/2016 | $10.00
7 | 11/12/2016 | $10.00
8 | 12/12/2016 | $10.00
------+--------------+-------------
| Sum | $80.00
------+--------------+-------------
| Sum |
| (no weekends)| $60.00
------+--------------+-------------
Run Code Online (Sandbox Code Playgroud)
编辑:我刚刚看了excel doc,它实际上是一个datetime字段,例如31/10/2016 12:44:00 pm(显示为31/10/16 12:44).
我也不是在寻找一个逐行工作的公式,我想要一些我可以复制并粘贴到每个月检查文档底部的单个单元格中的东西A:A.
我需要在用户注册时显示成功消息。下面我附上了代码。该代码未显示成功消息。怎么了。请帮忙。(这是 Asp.net 核心 MVC Web 应用程序)
[HttpPost]
public ActionResult Register(UserAccount user)
{
if (ModelState.IsValid)
{
_context.UserAccounts.Add(user);
_context.SaveChanges();
ModelState.Clear();
ViewBag.Message = "Successfully Registration Done";
}
return View();
}
Run Code Online (Sandbox Code Playgroud) 如何用什么都没有替换任何charachter.例如
1 : string inputString = "This Is Stack OverFlow";
2 : string outputString = inputString.Replace(' ', '');
expected output = "ThisIsStackOverFlow";
Run Code Online (Sandbox Code Playgroud)
我尝试过第2行,但它在Replace方法第二个参数中说空字符串.任何人都可以告诉我,我的替换方法有什么问题吗?为什么它不像我们通常在字符串中使用的那样空白(例如:"")?
c# ×5
asp.net-core ×1
asp.net-mvc ×1
c#-4.0 ×1
covariance ×1
excel ×1
generics ×1
javascript ×1
join ×1
jquery ×1
kendo-ui ×1
kendo-upload ×1
mysql ×1
regex ×1
viewbag ×1
where-clause ×1