我期待切换到C#.我来自C/C++背景,但C#对我来说有点不同.我的转换主要是因为Silverlight和MVVM; 所有例子都在C#中.任何信息都在C#中,当我全部阅读时,我感到很困惑.
从现有的C/C++知识开始,开始学习C#的好地方是什么?
我看到了这个:
public static <T,U extends T> AutoBean<T> getAutoBean(U delegate)
Run Code Online (Sandbox Code Playgroud)
我知道输入类是U类型,而AutoBean类是T类型,而U扩展T是边界。但是,这<T,是什么意思呢?
Also, if I am going to write a function to accept the output of getAutoBean, how would you write the function declaration? (i.e. myFunction(getAutoBean(...)), what will the function declaration of myFunction() be?)
Thank you!
我想在一个复选框周围装一个div.我这样做是因为我想用它来设置复选框的背景颜色.
我试过这个,但粉红色的div突出了复选框.
#checkbox{ margin:0px;
padding:0px;
opacity:0.5;}
#checkbox_wrapper{ background:pink;
float:left;}
<div id = "checkbox_wrapper" >
<input type="checkbox" id = "checkbox"/>
</div>
Run Code Online (Sandbox Code Playgroud) 如果我有这个代码:
public interface IJobHelper
{
List<T> FilterwithinOrg<T>(IEnumerable<T> entities) where T : IFilterable;
}
Run Code Online (Sandbox Code Playgroud)
有什么东西支持做这样的事情:
public interface IJobHelper
{
List<T> FilterwithinOrg<T>(IEnumerable<T> entities) where T : IFilterable or ISemiFilterable
}
Run Code Online (Sandbox Code Playgroud)
所以它会接受任何支持两个接口之一的东西.我基本上试图创建一个重载.
我正在处理的一些表具有空值并且抛出错误.到目前为止,我已经尝试了一些解决方案来处理空值但没有成功.
以下是我迄今为止努力的代码示例;
If (r("datemodified").Equals(DBNull.Value)) Then
datemodified = String.Empty
Else
datemodified = (r("datemodified"))
End If
Run Code Online (Sandbox Code Playgroud)
和;
If r.HasRows Then
datemodified = (r("datemodified"))
Else
datemodified = String.Empty
End If
Run Code Online (Sandbox Code Playgroud)
和;
If r("datemodified") = Nothing Then
datemodified = String.Empty
Else
datemodified = (r("datemodified"))
End If
Run Code Online (Sandbox Code Playgroud)
和;
If r.IsDBNull("datemodified") Then
datemodified = String.Empty
Else
datemodified = (r("datemodified"))
Run Code Online (Sandbox Code Playgroud)
并通过sql;
Select isnull(datemodified, '')
Run Code Online (Sandbox Code Playgroud)
最终结果是IndexOutOfRangeException.
这是sql;
select datemodified, maintainedby, email, hitcount from grouping where id = @footid
Run Code Online (Sandbox Code Playgroud)
ps,我运行了查询,它工作正常(即所有cols都存在)
所以,你们大概都看到了钢铁侠,Tony与一个名为Jarvis的AI系统进行交互.Demo clip here(对不起,这是商业广告).
我对C#,C++和Visual Basic非常熟悉,但我不确定我可以选择哪种方式来编写这样的东西.理想情况下,我希望通过自动化一些事情来帮助我在一些项目上工作.
经过一番研究后,我看到很多人都在使用苹果脚本.好吧,我是一个Windows开发人员,我在Windows上工作,所以,这是行不通的.
微软有一个Speech SDK,但我听说我无法编程来学习自定义单词......因为它只使用它的标准库.这是真的?使用SDK进行语音识别的其他限制是什么?那还有别的吗?
另外,哪种语言更适合用于这样的项目?C#还是VB?
我无法将这段代码(最初在VB中)转换为C#.特别是,如何将负数应用于int.
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
dim lStyle as long
lStyle = GetWindowLong(Lhwnd, GWL_STYLE)
lStyle = lStyle And Not WS_MAXIMIZEBOX
Run Code Online (Sandbox Code Playgroud) 不确定是否可能,但这已经困扰了我一段时间.
在SASS中是否可以在嵌套块中选择多个直接后代?
// This works
div
{
> .one
{
/* ... */
}
}
// This doesn't work
div
{
> .one,
> .two
{
/* ... */
}
}
Run Code Online (Sandbox Code Playgroud) 我希望能够检测到用户:
目前,我正在使用像这样的ASCII范围(C#语法):
string searchKeyWord = Console.ReadLine();
var romajis = from c in searchKeyWord where c >= ' ' && c <= '~' select c;
if (romajis.Any())
{
// Romajis
}
else
{
// Japanese input
}
Run Code Online (Sandbox Code Playgroud)
有没有更好,更快(更强...)的方法来做到这一点?
编辑:问题可以推广到具有非ASCII字符集的任何其他语言。