hi All,
I have an Array with bool values, the count of bool values is dynamic.
now I need to write the bool values (true/false) into a lable or textbox.
I have tried this but is not working
string abc = string.Join(",", _aControllersModel.A100Safety.ToString());
how to do this?
thanx in advance
Loading


VulpesRank #55 · 29.2K reputationPosted Aug 20, 2013, 5:51 AM EDT
Try this instead:
string abc = string.Join(",", _aControllersModel.A100Safety as bool[]);
VulpesRank #55 · 29.2K reputationPosted Aug 20, 2013, 4:51 AM EDT
Nayeem MansooriRank #3,979 · 374 reputationPosted Aug 20, 2013, 4:57 AM EDT
true, false, true, true, false, true, true, true, false, false
}; bool inVal = true; int i; i = testArray.Count(ai => ai == inVal);
ilhami caliskan79 reputationPosted Aug 20, 2013, 5:01 AM EDT
as result I get "System.Boolean[]" and not the content in this way
VulpesRank #55 · 29.2K reputationPosted Aug 20, 2013, 5:04 AM EDT
bool[] ba = {true, false};
string abc = string.Join(",", ba);
MessageBox.Show(abc);
and the result is:
True,False
so I don't understand why you're getting System.Bolean[]?
EDIT:
If I use:
string abc = string.Join(",", ba.ToString());
then I get System.Boolean[] so may be that's where you're going wrong?
ilhami caliskan79 reputationPosted Aug 20, 2013, 5:44 AM EDT
this is my code in MODEL;
public class AControllersModel
{
private Array a100Safety;
public Array A100Safety
{
get { return a100Safety; }
set { a100Safety = value; }
}
public delegate void AControllersModelUpdDlgHndl();
private AControllersModelUpdDlgHndl _aControllersModelUpdDlgHndlList;
public AControllersModelUpdDlgHndl AControllersModelUpdDlgHndlList
{
get { return _aControllersModelUpdDlgHndlList; }
set {_aControllersModelUpdDlgHndlList = value; }
}
}
this is my code in CONTROLLER;
private void handleModelUpdate()
{
string abc = string.Join(",",_aControllersModel.A100Safety);
label1.Text = "xyz " + abc;
}
RESULT is;
xyz System.Bolean[]
ilhami caliskan79 reputationPosted Aug 20, 2013, 6:00 AM EDT