我有类似的东西
bool a = true;
bool b = true;
bool plot = true;
if(plot)
{
if(a)
{
if(b)
b = false;
else
b = true;
//do some meaningful stuff here
}
//some more stuff here that needs to be executed
}
Run Code Online (Sandbox Code Playgroud)
我想打破if测试b何时变为false的语句.有点喜欢休息并继续循环.有任何想法吗?编辑:抱歉忘了包含大if语句.我想打破if(a)当b是假的但是没有突破if(plot).
我有两个构造函数:
public ViewDigiFiles()
{
InitializeComponent();
InitializeMyGLControl();
InitializeMyScrollBar();
InitializeMouseEvents();
InitializeKeyboardControls();
InitializeContextMenu();
InitializeComboBox();
InitializeToolStripView();
InitializeListBox();
setToDefaultScale();
}
public ViewDigiFiles(List<SelectDataLog.DataLog> d)
:this()
{
//how to execute this line first before calling this()?
datalogList = d;
}
Run Code Online (Sandbox Code Playgroud)
有没有办法datalogList = d;在初始化函数之前执行而不复制并粘贴其下的所有内容?谢谢!
我有一个字符串"5-13-2013"我想使它看起来像"051313"所有三个字段(月,日,年)必须有2位数,如果它只有一个,我需要在前面添加一个零
这么简单吗?
我有一个带有两个Datalog类变量的Form
public partial class ModifyDataForm : Form
{
public DataLog DLog;
private DataLog copyCurrent;
public ModifyDataForm(DataLog log, int selectIndex = 0)
{
InitializeComponent();
DLog = (DataLog)log.Clone();
copyCurrent = (DataLog)log.Clone();
}
}
Run Code Online (Sandbox Code Playgroud)
当我更新DLog的值时,copyCurrent的值也会改变,为什么?
我更新变量的函数如下
private void smooth_Click(object sender, EventArgs e)
{
int NValues; int POrder;
if (getSmoothParameters(out NValues, out POrder))//parameters are valid
{
float[] yvalues = DataLog.convertStringArrayToFloats(DLog.Data[labelIndex]);
float[] newyvalues = Filters.smooth.SavitzkyGolay(yvalues, NValues, POrder);
//I am updating the values of DLog here,
//but the values of copyCurrent also changes
DLog.Data[labelIndex] = Array.ConvertAll(newyvalues, …Run Code Online (Sandbox Code Playgroud)