我是C#Programming的新手,而不是让我按F5运行代码,"Attach ..."出现在Run按钮的位置,它不会让我运行代码.这已经发生了两次,我不知道如何再次出现"运行"按钮,因为我无法测试我编写的任何程序.
public static int[,] operator *(int[,] arr1, int[,] arr2)
{
int sum;
int[,] res = new int[arr1.GetLength(0), arr2.GetLength(1)];
for (int i = 0; i < arr1.GetLength(0); i++)
{
for (int j = 0; j < arr2.GetLength(1); j++)
{
sum = 0;
for (int k = 0; k < arr1.GetLength(1); k++)
{
sum = sum + (arr1[i, k] * arr2[k, j]);
}
res[i, j] = sum;
//Console.Write("{0} ", res[i, j]);
}
//Console.WriteLine();
}
return res;
}
Run Code Online (Sandbox Code Playgroud)
这里我试图重载*运算符乘以两个矩阵..但编译器继续向我显示错误..
"二元运算符的一个参数必须是包含类型c#"
请告诉我我的代码中有什么问题以及如何解决它.
那可能吗?我注意到每次添加项目(代码或XAML文件)时都会将其复制到项目文件夹中.这样我就无法单独保存可重用文件.我可以用它们构建一个dll,但这样做太过分了,在一般情况下它非常不方便,因为对于每个项目我只对所有可重用类的子集感兴趣.
我正在尝试在我的Visual C#2010 Express安装中加载项目.该项目是由另一位使用Visual Studio 2010的同学创建的.这是一个存根项目(没有实际代码).当我尝试加载它时,我得到" 此安装不支持项目类型 "错误,并且上面的SO解决方案没有帮助,因为我不知道认为Express有命令行的事情.我试过这个SO解决方案,但它根本没有帮助我.
如何加载项目?
PS项目中没有复杂的单元测试.它实际上是一个没有重要代码的存根.
编辑:这是一个csproj文件,根据要求:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{C1F8CC60-8F0A-4BAA-BC5B-B3603F662F26}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Team10BuyerSeller</RootNamespace>
<AssemblyName>Team10BuyerSeller</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" …Run Code Online (Sandbox Code Playgroud) 我正在制作一个表单应用程序是Visual C#.我有一个文本框,用户必须输入一个数字和一个大写字母,例如"9D".
我需要做的是将该字母作为字节放入字节数组中...所以在我的字节数组中它将:
array[index] = 0x9D
Run Code Online (Sandbox Code Playgroud)
我知道textbox类将9D表示为字符串.我很困惑如何将它变成一个字面字节(9D)并将其粘贴在数组中.
新的.Net所以任何帮助将不胜感激.我看过System.Convert类,看不到任何我可以使用的东西.
我正在尝试读取RSS提要并在我的C#应用程序中显示.我使用下面的代码,它适用于其他RSS源.我想阅读这个RSS源---> http://ptwc.weather.gov/ptwc/feeds/ptwc_rss_indian.xml,下面的代码不起作用.我没有得到任何错误但没有任何反应,我想要显示RSS提要的文本框是空的.请帮忙.我究竟做错了什么?
public class RssNews
{
public string Title;
public string PublicationDate;
public string Description;
}
public class RssReader
{
public static List<RssNews> Read(string url)
{
var webResponse = WebRequest.Create(url).GetResponse();
if (webResponse == null)
return null;
var ds = new DataSet();
ds.ReadXml(webResponse.GetResponseStream());
var news = (from row in ds.Tables["item"].AsEnumerable()
select new RssNews
{
Title = row.Field<string>("title"),
PublicationDate = row.Field<string>("pubDate"),
Description = row.Field<string>("description")
}).ToList();
return news;
}
}
private string covertRss(string url)
{
var s = RssReader.Read(url);
StringBuilder sb = …Run Code Online (Sandbox Code Playgroud) 这是一个非常基本的问题,但我似乎无法找到它.它曾经在Visual C#Express 2005的View菜单中.我总是可以使用这些属性来手动设置选项卡索引,但对于较大的表单来说,它是单调乏味的.谢谢.
我开发了一个C#应用程序,我想将它部署到该C:\Program Files\Company Name\Product文件夹.我没有看到在目标计算机上创建的"公司名称"文件夹.
我将文件从"已发布"目录复制到记忆棒(拇指驱动器)上.我将记忆棒带到Windows NT机器并双击setup.exe.应用程序已安装,因为它出现在*开始菜单中.我不知道实际目的地在哪里.我知道它不在C:\Program Files\Company Name\Product文件夹中.
我使用的是MS Visual C#2008 Express Edition版本3.5 SP1.本产品使用严格限制的ClickOnce安装程序.不幸的是,这是我给予的工作.
如何告诉C#express将我的应用程序部署到该C:\Program Files\Company Name\Product文件夹中?
很抱歉,如果这是重复的,因为我很难搜索有关此问题的任何信息.
注意:我正在64位Windows 7平台上开发.
编辑:
我在"程序集信息"对话框中填写了标题,公司,产品,版权,版本和GUID字段.公司名称是两个单词之间的空格.这个空间会造成问题吗?
我目前正在使用此代码:
foreach (DataGridViewRow item in this.dataGridView1.SelectedRows)
{
dataGridView1.Rows.RemoveAt(item.Index);
}
Run Code Online (Sandbox Code Playgroud)
我在第一列中有复选标记,但是使用此代码,它只会被选中.我如何获取选中的CheckBoxes 只能删除行?
我一直试图做出类似的事情...
我看了看,只发现了这篇文章.我无法将其集成到我的应用程序中.我今天刚刚开始WPF,所以我正在学习.我已经下载了窗口.壳牌dLL.我还需要什么?谢谢!
c# ×9
.net ×1
clickonce ×1
deployment ×1
publishing ×1
rss ×1
rss-reader ×1
window ×1
windows ×1
windows-7 ×1
winforms ×1
wpf ×1