Constructor()

Namespace ›› System ›› MfCollection ›› Methods ››
Parent Previous Next

Constructor()

Constructor for MfCollection Class

obj := new MfCollection()

Example

MyCol := new MfCollection()

loop, 10
{
   MyCol.Add("MyItem-" . A_Index)
}
MyEnum := MyCol.GetEnumerator()

mfs := new MfString()
MaxIndex := MyCol.Count -1
While MyEnum.Next(i, v)
{
   mfs.Append(MfString.Format("Index: {0}, Value: '{1}'", i, v))
   if (i < MaxIndex)
   {
       mfs.AppendLine()
   }
}

MsgBox % mfs.Value

; alternatively we can do this
mfs := new MfString()
MaxIndex := MyCol.Count -1
for i, v in MyCol
{
   mfs.Append(MfString.Format("Index: {0}, Value: '{1}'", i, v))
   if (i < MaxIndex)
   {
       mfs.AppendLine()
   }
}

MsgBox % mfs.Value

; mfs.Value contains
/*
Index: 0, Value: 'MyItem-1'
Index: 1, Value: 'MyItem-2'
Index: 2, Value: 'MyItem-3'
Index: 3, Value: 'MyItem-4'
Index: 4, Value: 'MyItem-5'
Index: 5, Value: 'MyItem-6'
Index: 6, Value: 'MyItem-7'
Index: 7, Value: 'MyItem-8'
Index: 8, Value: 'MyItem-9'
Index: 9, Value: 'MyItem-10'
*/