(Inherits from MfListBase)
MfGenericList class exposes methods and properties used for common List and array type operations for strongly typed collections that derive from specified type
Name |
Description |
|
Initializes a new instance of the MfGenericList class. |
Name |
Description |
|
Gets a value indicating if the MfListBase number of Elements. Inherited from MfListBase |
||
Gets a value indicating if the MfListBase has a fixed size. Inherited from MfListBase |
||
Gets a value indicating if the MfListBase is read-only. Inherited from MfListBase |
||
Gets or sets the element at the specified index. Overrides MfListBase.Item. |
||
Gets a MfType instance representing the allowable types that can be added to this instance of MfGenericList. |
Name |
Description |
|
Returns a new enumerator to enumerate this object's key-value pairs. This method is usually not called directly, but by the for-loop or by GetEnumerator(). Inherited from MfListBase |
||
Adds an element to the end of the current instance. Overrides MfListBase.Add() |
||
Adds MfAttribute extended items to extended classes. Inherited from MfObject. |
||
Removes all elements from the instance and sets Count to Zero. Inherited from MfListBase |
||
Clones all the elements of the current instance an return a new instance. Overrides MfListBase.Clone(). |
||
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. Inherited from MfObject. |
||
Determines whether the MfGenericList contains a specific element. |
||
Compares obj to current instance to see if they are the same. Inherited from MfObject. |
||
Gets an MfAttribute of the class. Inherited from MfObject. |
||
Gets a MfGenericList of MfAttribute that Contains the attributes for the current class instance. Inherited from MfObject. |
||
Gets an enumerator. Inherited from MfEnumerableBase |
||
Searches for the specified var and returns the index of the first occurrence within the entire instance. |
||
Inserts an element into the MfGenericList at the specified index. |
||
Gets the zero-based index value of the position of MfAttribute within the instance of the class. Inherited from MfObject. |
||
Gets the Type for the for the Class .Inherited from MfObject. |
||
Gets if the current instance of class derived from MfSystemException has MfAttribute. Inherited from MfObject. |
||
Gets if current instance of object is of the same type. Inherited from MfObject. Inherited from MfObject. |
||
Get if the current class is an instance. Inherited from MfObject. |
||
Searches for the specified Object and returns the zero-based index of the Last occurrence within the entire MfGenericList. |
||
Creates a shallow copy of the current MfObject instance. Inherited from MfObject. |
||
Removes the first occurrence of a specific object from the MfGenericList. |
||
RemoveAt(index) |
Removes the MfGenericList item at the specified index. |
|
Returns a One-Based AutoHotkey array representing all the elements in the current instance. Inherited from MfListBase |
||
Gets a string representation of the object elements. Inherited from MfListBase |
||
Verifies the the current object is set to an instance. Inherited from MfObject. |
||
VerifyIsNotInstance([MethodName, LineFile, LineNumber, Source]) |
Verifies the the current object is NOT set to an instance. Used in Static methods. Inherited from MfObject. |
stud1 := new Student()
stud1.Id := "RT34TTTSV"
stud1.Name := "Frank Smith"
stud1.Age := 21
stud1.HomeRoom := "English 101"
stud2 := new Student()
stud2.Id := "WRT556SV"
stud2.Name := "Sue Smith"
stud2.Age := 20
stud2.HomeRoom := "French 102"
stud3 := new Student()
stud3.Id := "GTUFF7SV"
stud3.Name := "Bob Smith"
stud3.Age := 22
stud3.HomeRoom := "Math 201"
mfGl := new MfGenericList(Student)
mfGl.Add(stud1)
mfGl.Add(stud2)
mfGl.Add(stud3)
MsgBox, 64, Student Count, % MfString.Format("There are currently {0} Students", mfGl.Count)
for i, st in mfGl
{
st.EnrollmentYear := A_Year
}
MsgBox % mfGl.Item[0].EnrollmentYear
mfI := new MfInteger(24)
; Next line results in MfNotSupportedException only Student object can be added
mfGl.Add(mfI)
ExitApp
Class Student extends MfObject
{
m_Id := ""
m_Name := ""
m_Age := 0
m_HomeRoom := ""
m_EnrollmentYear := 0
Id[]
{
get {
return this.m_Id
}
set {
this.m_Id := MfString.GetValue(value)
return this.m_Id
}
}
Name[]
{
get {
return this.m_Name
}
set {
this.m_Name := MfString.GetValue(value)
return this.m_Name
}
}
Age[]
{
get {
return this.m_Age
}
set {
this.m_Age := MfInteger.GetValue(value, 0)
return this.m_Age
}
}
HomeRoom[]
{
get {
return this.m_HomeRoom
}
set {
this.m_HomeRoom := MfString.GetValue(value)
return this.m_HomeRoom
}
}
EnrollmentYear[]
{
get {
return this.m_EnrollmentYear
}
set {
this.m_EnrollmentYear := MfInteger.GetValue(value, 0)
return this.m_EnrollmentYear
}
}
; Override ToString()
ToString()
{
; throw an error if called as static method
this.VerifyIsInstance(this, A_LineFile, A_LineNumber, A_ThisFunc)
return MfString.Format("ID:'{0}', Name:'{1}', Age:'{2}'", this.Id, this.Name, this.Age)
}
}