我的代码如下
public CountryStandards()
{
InitializeComponent();
try
{
FillPageControls();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Country Standards", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
/// <summary>
/// Fills the page controls.
/// </summary>
private void FillPageControls()
{
popUpProgressBar.IsOpen = true;
lblProgress.Content = "Loading. Please wait...";
progress.IsIndeterminate = true;
worker = new BackgroundWorker();
worker.DoWork += new System.ComponentModel.DoWorkEventHandler(worker_DoWork);
worker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(worker_ProgressChanged);
worker.WorkerReportsProgress = true;
worker.WorkerSupportsCancellation = true;
worker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.RunWorkerAsync();
}
private void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
GetGridData(null, 0); // filling grid …Run Code Online (Sandbox Code Playgroud) 我的代码是
public class Parent
{
public Parent(int i)
{
Console.WriteLine("parent");
}
}
public class Child : Parent
{
public Child(int i)
{
Console.WriteLine("child");
}
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:
Parent不包含带0参数的构造函数.
我理解问题是Parent没有带0参数的构造函数.但我的问题是,为什么我们需要一个零参数的构造函数?没有它,为什么代码不工作?
我工作的应用程序包含一个Web角色:它是一个简单的Web应用程序.我需要在Windows Azure中托管应用程序,因此我创建了一个Web角色.我其实想知道这些角色是什么.他们的编码明智或存储方面的意义是什么?
azure azure-worker-roles azure-web-roles azure-vm-role azure-virtual-machine
我有一个字符串"4,6,8 \n9,4"
我想基于和\n分割这个
输出数组应该是
4
6
8
9
4
Run Code Online (Sandbox Code Playgroud)
编辑:
现在我正在从控制台读取字符串,当我在控制台中输入如上所示的字符串时,在后面的代码中我得到了"4,6,8\\n9,4".现在我想分开使用"," and "\\n".我怎样才能改变表达方式?
伙计我是WPF的新手.
我有一个名为的wpf页面StandardsDefault.在后面的代码中 ,就像所有其他页面一样StandardsDefault 继承 Page.
<Page x:Class="namespace.StandardsDefault"
public partial class StandardsDefault : Page
Run Code Online (Sandbox Code Playgroud)
现在我创建了一个CountryStandards继承StandardsDefault而不是页面的新类.
<Page x:Class="namespace.CountryStandards"
public partial class CountryStandards : StandardsDefault
Run Code Online (Sandbox Code Playgroud)
我没有改变XAML.我收到的错误是
"部分声明
'CountryStandards'不得指定不同的基类"
我认为问题可能是设计者没有继承同一个类.但是我需要以某种方式实现继承,因为有许多常用的方法可以在许多标准页面中使用,例如CountryStandards
谁能帮我吗?
我把控件放在DataGrid这样:
<Label Name="lblDescription" HorizontalAlignment="Left" Margin="0,5,0,0" Grid.Row="2" Grid.Column="2" />
<TextBox Name="txtDescription" HorizontalAlignment="Left" Width="200" Margin="0,5,0,0" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True" Grid.RowSpan="2" Grid.Row="2" Grid.Column="3" />
Run Code Online (Sandbox Code Playgroud)
如何更改代码背后的控件Grid.Row和Grid.Column控件?
我有一个继承接口的类.接口成员方法是在我的类中实现的,没有访问修饰符(因此,默认情况下它是私有的).
我收到错误"无法实现接口成员,因为它不公开".
为什么不允许这样做?我不能覆盖辅助功能吗?
值类型行为表明,我们持有的任何值都无法通过其他变量进行更改.
但是我仍然对我在这篇文章标题中提到的内容感到困惑.任何人都可以澄清吗?
嗨,我是xml的新手
我有这样的查询
SELECT ProjectId,
ProjectCode,
ProjectName,
TechId,
-- LocationId,
( SELECT GeoId,PoliticalDivisionId ,GeographicLocationName,IsoCode,Longitude,Latitude,ParentLocationId,
t2.CreatedBy,t2.CreatedOn,t2.LastUpdatedBy,t2.LastUpdatedOn
FROM GeographicLocation t2
WHERE GeoId = t1.LocationId
FOR XML PATH('Location') ),
RtoId,
CreatedBy,
CreatedOn,
LastUpdatedBy,
LastUpdatedOn
FROM Project t1
where ProjectId=1
FOR XML PATH('ProjectInfo')
Run Code Online (Sandbox Code Playgroud)
它将xml返回为
<ProjectInfo>
<ProjectId>1</ProjectId>
<ProjectCode>US-W1-00001</ProjectCode>
<ProjectName>Rees</ProjectName>
<TechId>1</TechId>
<Location><GeoId>235</GeoId><PoliticalDivisionId>2</PoliticalDivisionId><GeographicLocationName>UNITED STATES</GeographicLocationName><IsoCode>US</IsoCode></Location>
<RtoId>3</RtoId>
<CreatedBy>1</CreatedBy>
<CreatedOn>2013-06-30T20:55:21.587</CreatedOn>
<LastUpdatedBy>1</LastUpdatedBy>
<LastUpdatedOn>2013-06-30T20:55:21.587</LastUpdatedOn>
Run Code Online (Sandbox Code Playgroud)
prject标签以<和>的形式显示.但是Location的内部标签显示为"<"和">"如何用<和>替换它们
更新:问题中出现了一个小错误.内部xml不适用于rtoid,它适用于位置
我将查询更新为
SELECT ProjectId,
ProjectCode,
ProjectName,
TechId,
-- LocationId,
replace(replace( ( SELECT GeoId,PoliticalDivisionId ,GeographicLocationName,IsoCode,Longitude,Latitude,ParentLocationId,
t2.CreatedBy,t2.CreatedOn,t2.LastUpdatedBy,t2.LastUpdatedOn
FROM GeographicLocation t2
WHERE GeoId = t1.LocationId
FOR XML PATH('Location') ), '<', …Run Code Online (Sandbox Code Playgroud) 我知道属性的基本功能.但是当我深入阅读文档时,我发现它们只是在get set和没有变量的情况下被声明.
这两者之间有什么不同
public int EmpCode
{
get { return _strEmpCode; }
set { _strEmpCode = value; }
}
Run Code Online (Sandbox Code Playgroud)
和
public int EmpCode
{
get;
set;
}
Run Code Online (Sandbox Code Playgroud)
这是一种更简单的写作方式,随着.net框架的升级而得到了.或者有任何功能差异?
c# ×8
wpf ×3
inheritance ×2
.net ×1
azure ×1
class ×1
constructor ×1
for-xml ×1
for-xml-path ×1
interface ×1
properties ×1
split ×1
sql-server ×1
string ×1
value-type ×1