- Home /
Question by
danny1111 · Jun 18, 2017 at 04:33 PM ·
listbooleansystem.collections.generic
bool[] to bool list
Is there a way to solve the following error without having to use one or the other. I want to use both so is there a way of converting from one to the other.
'cannot implicitly convert type bool[] to System.Collections.Generic.List'
Comment
Best Answer
Answer by JxWolfe · Jun 18, 2017 at 07:26 PM
Yes!
bool[] myBoolArray;
List myBoolList;
//converting List to bool []
myBoolArray = myBoolList.ToArray ();
//converting bool[] to List
for (int i = 0; i < myBoolArray.Length; i++) {
myBoolList.Add (myBoolArray [i]);
}
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Problem Checking A List 0 Answers
NullReference when updating a List 4 Answers
Check to see if any bool instance is true? 1 Answer
How to make the Boolean equal to true for only one object 1 Answer