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

VulpesPosted Aug 20, 2013, 9:51 AM
Try this instead:
string abc = string.Join(",", _aControllersModel.A100Safety as bool[]);
ilhami caliskanPosted Aug 20, 2013, 10:00 AM
ilhami caliskanPosted Aug 20, 2013, 9:44 AM
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[]
VulpesPosted Aug 20, 2013, 9:04 AM
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 caliskanPosted Aug 20, 2013, 9:01 AM
as result I get "System.Boolean[]" and not the content in this way
Nayeem MansooriPosted Aug 20, 2013, 8:57 AM
true, false, true, true, false, true, true, true, false, false
}; bool inVal = true; int i; i = testArray.Count(ai => ai == inVal);
VulpesPosted Aug 20, 2013, 8:51 AM