我使用的是VSTS 2008 + C#+ .Net 2.0.当执行以下语句时,会从String.Format语句中抛出FormatException,任何想法有什么问题?
这是获取我正在使用的template.html的地方.我想在template.html中格式化此部分m = {0}.
string template = String.Empty;
using (StreamReader textFile = new StreamReader("template.html"))
{
template = textFile.ReadToEnd();
String.Format(template, "video.wmv");
}
Run Code Online (Sandbox Code Playgroud)
http://www.mediafire.com/download.php?u4myvhbmmzg
编辑1:
这是我的template.html的内容,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<!-- saved from url=(0014)about:internet -->
<head>
<title>Silverlight Project Test Page </title>
<style type="text/css">
html, body {
height: 100%;
overflow: auto;
}
body {
padding: 0;
margin: 0;
}
#silverlightControlHost {
height: 100%;
}
</style>
<script type="text/javascript">
function onSilverlightError(sender, args) { …
Run Code Online (Sandbox Code Playgroud) 我正在调试codeplex简单项目.我在用
我没有修改此codeplex项目的任何代码,只需按F5即可运行VideoPlayerWeb项目.
我遇到的当前问题是错误消息 -
无法连接到ASP.Net Development Server.
单击F5时,这是我的屏幕快照.有什么想法有什么不对?
我的内存是4G物理,但即使我只创建1.5G内存对象,为什么我的内存异常.有什么想法吗?(我在同一时间看到,在任务管理器的性能选项卡中,内存未被完全占用,我也可以在这里输入 - 所以内存实际上并不低,所以我认为我遇到了其他一些内存限制)?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestBigMemoryv1
{
class MemoryHolderFoo
{
static Random seed = new Random();
public Int32 holder1;
public Int32 holder2;
public Int64 holder3;
public MemoryHolderFoo()
{
// prevent from optimized out
holder1 = (Int32)seed.NextDouble();
holder2 = (Int32)seed.NextDouble();
holder3 = (Int64)seed.NextDouble();
}
}
class Program
{
static int MemoryThreshold = 1500; //M
static void Main(string[] args)
{
int persize = 16;
int number = MemoryThreshold * 1000 * 1000/ persize;
MemoryHolderFoo[] pool …
Run Code Online (Sandbox Code Playgroud) 我正在使用SQL Server 2008.我知道如果表没有聚簇索引,那么它被称为堆,否则存储模型称为聚簇索引(B-Tree).
我想了解更多关于堆存储的确切含义,它看起来是什么以及它是否被组织为"堆"数据结构(例如最小堆,最大堆).有推荐的读数吗?我想要更多内部,但不是太深.:-)
乔治,提前谢谢
我正在使用.Net 3.5(C#),我听说C#的性能List<T>.ToArray
"糟糕",因为它为所有元素的内存副本形成了一个新的数组.真的吗?
我正在使用VSTS 2008 + ADO.Net + C#+ .Net 3.5 + SQL Server 2008.我在客户端使用ADO.Net连接到数据库服务器以执行存储过程,然后从存储过程返回结果.
这是我的代码.我有两个关于超时的问题,
如果我没有明确设置任何与超时相关的设置,对于与数据库服务器的连接,是否有任何超时设置(例如,如果在一段默认时间内无法连接到数据库服务器,会有一些超时异常?)?
如果我没有明确设置任何超时相关设置,对于执行存储过程,是否有任何超时设置(例如,如果无法从服务器检索到ADO.Net客户端的结果一段默认时间,则会有一些超时例外?)?
using (SqlConnection currentConnection = new SqlConnection("Data Source=.;Initial Catalog=TestDB;Trusted_Connection=true;Asynchronous Processing=true"))
{
// check current batch conut
currentConnection.Open();
using (SqlCommand RetrieveOrderCommand = new SqlCommand())
{
RetrieveOrderCommand.Connection = currentConnection;
RetrieveOrderCommand.CommandType = CommandType.StoredProcedure;
RetrieveOrderCommand.CommandText = "prc_GetOrders";
RetrieveBatchCountCommand.Parameters.Add("@Count", SqlDbType.Int).Direction = ParameterDirection.Output;
RetrieveBatchCountCommand.ExecuteNonQuery();
int rowCount = Convert.ToInt32(RetrieveOrderCommand.Parameters["@Count"].Value);
}
}
Run Code Online (Sandbox Code Playgroud)我对XSLT apply-template语句感到困惑.例如,在w3school.
http://www.w3schools.com/xsl/xsl_apply_templates.asp
对于陈述,
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
我的困惑是,
(1)功能是<xsl:apply-templates/>
什么?它不包含任何要调用的特定模板.我认为它会匹配(返回)当前元素的所有直接子节点(当前节点的非直接子节点不会被返回,当前节点是根节点),不确定我是否正确?
(2)在(1)中返回所有匹配的节点之后,XSLT处理器将做的下一步是什么?
(3)在这个特定的样本中,根节点是目录还是另一个更高级别的根?为什么?
乔治,提前谢谢
我正在使用VSTS 2008 + .Net 3.5 + C#来开发Windows窗体应用程序.我的困惑是,似乎Application.Exit不强制应用程序终止?如果没有,我应该调用哪个方法使应用程序终止?
编辑1:
通常主要方法是这样的,如何在不调用Environment.Exit的情况下优雅地退出Main函数?
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
try
{
Application.Run(new Form1());
}
catch (Exception ex)
{
Console.WriteLine (ex.Message);
}
}
Run Code Online (Sandbox Code Playgroud)
乔治,提前谢谢
假设我在html中有以下代码行,如何使用Javascript以简单的方式在编程方式中设置"MonitorInformation"DIV元素中的文本颜色和大小?对不起我的愚蠢,我想了很长时间,但想不通.:-(
<div id="MonitorInformation">Connecting...wait</div>
Run Code Online (Sandbox Code Playgroud)
乔治,提前谢谢
我正在使用SQL Server 2008 Enterprise.我想将一个标识列(作为唯一聚簇索引和主键)添加到现有表.基于整数的自动增加1个标识列是可以的.有解决方案吗
BTW:我最困惑的是现有行,如何自动填写新的标识列数据?
乔治,提前谢谢