我一直在使用ILSpy查看.NET库,并List<T>在System.Collections.Generic命名空间中遇到了类定义.我看到该类使用类似这样的方法:
// System.Collections.Generic.List<T>
/// <summary>Removes all elements from the <see cref="T:System.Collections.Generic.List`1" />.</summary>
public void Clear()
{
if (this._size > 0)
{
Array.Clear(this._items, 0, this._size);
this._size = 0;
}
this._version++;
}
Run Code Online (Sandbox Code Playgroud)
所以,类的Clear()方法List<T>实际上使用Array.Clear方法.我已经看到许多其他List<T>方法在体内使用Array的东西.
这是否意味着List<T>实际上是一个秘密数组或List只使用了一些Array方法?
我知道列表是类型安全的,不需要装箱/拆箱,但这让我有点困惑.
我需要在C程序中计算一个角度.这是我需要转换为C的JAVA方法.
private static double calculateDirection(double x, double y)
{
return Math.toDegrees(Math.atan2(y, x));
}
Run Code Online (Sandbox Code Playgroud)
是否有像C语言中的toDegrees这样的函数,所以我不必自己编写所有代码?谢谢
我在添加到我的word文档的超链接时遇到了麻烦.我不知道怎么做.我想使用open xml在我的C#代码中的word文档中建立链接.是否只使用href或类似的不同解决方案?Open XML上有一个HyperLink类但是如何使用它?
如果您能给我一个简短的教程而不是几句话,那就太好了。
我的 CUDA 应用程序正在按照我的意愿运行。现在,问题是如何将 CUDA 代码导出到 C#,因为我想用 C# 来制作前端和其他所有内容。
从这个链接:
http://www.codeproject.com/Articles/9826/How-to-create-a-DLL-library-in-C-and-then-use-it-w
我知道如何用 C 语言制作一个库,可以将其作为 Win32 dll 导入到 C# 应用程序中。
但我的问题是,如何制作可以传送到 C# 并从 C# 应用程序使用的 CUDA 应用程序 dll(或其他扩展)? 如果有 CUDA 的教程,例如 C 库到 C# 应用程序的教程(上面的链接),那就太好了。
我使用的是 Win7 64 位、Visual Studio 2010 Ultimate、Cuda Toolikt 5.0 和 NSight 2.2.012313
输出到word文档(docx).
我想使用C#4.0 string.Format来做这样的outuput:
string1: stringValue1, string2:stringValue2
string4: stringValue4, string5:stringValue5
string6: stringValue6, string7:stringValue7
string8: stringValue8, string9:stringValue9
Run Code Online (Sandbox Code Playgroud)
我正在使用string.Format("{0,-10} {1,-10}",string1,string2)但它什么也没做.有没有办法如何使用string.Format()对齐字符串?我看到'\ t'解决方案,但如何将其添加到string.Fornmat()?
这是我的代码和输出:
string titel = HttpUtility.HtmlEncode(docItem.Title);
string href = docItem.FullURL;
string title = string.Format("{0}", titel);
string author = docItem.Author;
string date = docItem.ChangedDate.Date.ToShortDateString();
CreateTextBoxConentParagraph(doc, string.Format("Title: <a href='{0}'>{1}</a> Author: {2} Geändert an: {3}",href,title.PadRight(20),author.PadRight(20), date),string.Format("chunkId_{0}", i++));
Run Code Online (Sandbox Code Playgroud)
输出:标题:作者:aaaGeändertan:19.04.2013
标题:第二作者:aaaGeändert和:2013年4月18日
标题:slika作者:aaaGeändertan:18.04.2013
标题:dm作者:aaaGeändertan:18.04.2013
标题:Mathias作者:aaaGeändertan:19.04.2013
标题:QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQqq作者:aaaGeändertan:19.04.2013
我想知道在C#类中列出下拉列表的方法.我一直在尝试这样:
List<DropDownList> _ddlCollection;
for (int i = 0; i < 5; i++)
{
_ddlCollection.Add(new DropDownList());
}
Run Code Online (Sandbox Code Playgroud)
然后我将_ddlCollection添加到Asp.NET站点,如下所示:
foreach (DropDownList ddl in _ddlCollection)
{
this.Controls.Add(ddl);
}
Run Code Online (Sandbox Code Playgroud)
但它突破了:
_ddlCollection.Add(new DropDownList());
Run Code Online (Sandbox Code Playgroud)
你能告诉我如何在列表中添加一些DDL吗?
我一直在Jason Sanders和Edward Kandrot的例子中阅读CUDA,他们遇到了第4章,他们用CUDA解决了Julia Set.此外,书籍页面上还有一个源代码; https://developer.nvidia.com/content/cuda-example-introduction-general-purpose-gpu-programming-0
当我尝试包含项目所需的所有文件(所有头文件和.cu文件)时,它将无法编译.我通常从头开始创建的CUDA项目没有问题(VS 2010,CUDA 5.0).
有没有人有同样的问题,你可以请指出每一步,以使这个朱莉娅集设置应该是吗?
PS这是一个在头文件中不起作用的代码:
/*
* Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property and
* proprietary rights in and to this software and related documentation.
* Any use, reproduction, disclosure, or distribution of this software
* and related documentation without an express license agreement from
* NVIDIA Corporation is strictly prohibited.
*
* Please refer to the applicable NVIDIA end user license agreement …Run Code Online (Sandbox Code Playgroud) 我的模型中有一个属性,如下所示:
public IList<SelectListItem> AllCards { get; set; }
Run Code Online (Sandbox Code Playgroud)
SelectListItem控制器使用数据库中的数据来填充属性.
另外,在我的视图中@Html.DropDownListFor(m=>m.AllCards,Model.AllCards,"--Select--").在POST视图期间出现问题.也就是说,onSubmit我Model.AllCards是空的,尽管在下拉列表中选择了一个值.我尝试将新属性添加到模型中,如下所示:
public SelectListItem SelectedCard
Run Code Online (Sandbox Code Playgroud)
然后像这样改变视图:
@Html.DropDownListFor(m=>m.AllCards,Model.SelectedCard,"--Select--")
Run Code Online (Sandbox Code Playgroud)
但它给了我一个错误,说转换不可能,就像那样.
我应该怎么做才能捕获我的dropdownlist值,以便在调用视图的POST版本后它可以在模型内部?谢谢
PS我知道有十个类似的问题,但没有一个有用.
我想知道有没有办法从SQL表中检索包含100行的第2行和第5行?
我看到了一些带有WHERE子句的解决方案,但他们都假设WHERE应用了哪个子句的列是线性的,从1开始.
是否有其他方法可以查询SQL Server表中的特定行,以防表中的表没有值为1的列?
PS - 我知道有一个临时表的解决方案,你可以复制你的select语句输出并向表中添加一个线性列.我正在使用T-SQL
我一直在研究使用ILSpy的.NET程序集.我想知道定义"IS"(和"AS")关键字的位置,以便我可以看看它的定义,看看在.NET中如何定义"IS"运算符.谢谢
我想知道,在你从一个实现某个接口的对象转换到那个特定的接口之后,参考内容会去哪里?这是一个例子:
MyClass mc = new MyClass();
MyClass实现了IIfc.所以,这是界面的转换:
IIfc ifc = (IIfc) mc;
Run Code Online (Sandbox Code Playgroud)
ifc保存的内容在哪里,我知道它在堆上,但是它是mc实例的一部分还是在某些其他内存地址中指向属于ifc的mc方法?
PS:我看到很多人没有得到这个问题.ifc指向的地址在哪里?它是在对象(mc)内还是在堆的其他位置?
c# ×7
.net ×5
c ×3
asp.net ×2
cuda ×2
nvidia ×2
asp.net-mvc ×1
clr ×1
openxml ×1
razor ×1
sharepoint ×1
sql ×1
sql-server ×1
string ×1