📄 classcollection.format
字号:
<OrmLib.TypedCollectionAttribute(GetType({0}))>public MustInherit class {0}CollectionOrmTemplate : Inherits CollectionTemplate
Public Sub New()
MyBase.New(GetType({0}))
End Sub
Default Public Property MyProperty(ByVal Index As Integer) As {0}
Get
return CType(Me.List(index),{0})
End Get
Set(ByVal Value As {0})
Throw New NotSupportedException("Please use the Add() method.")
End Set
End Property
Public Function FilterBy(ByVal propertyName As String, ByVal searchValue As Object) As {0}Collection
Return FilterBy(propertyName, searchValue, CompareType.Exact)
End Function
Public Function FilterBy(ByVal propertyName As String, ByVal searchValue As Object, ByVal comparer As CompareType) As {0}Collection
Dim retCollection = New {0}Collection()
Dim _{0} As {0}
For Each _{0} In Me.List
If Match(comparer, _{0}(propertyName), searchValue) Then
retCollection.Add(_{0})
End If
Next
Return retCollection
End Function
Public Function SortBy(ByVal propertyName As String) As {0}Collection
Return SortBy(propertyName, SortDirection.Ascending)
End Function
Public Function SortBy(ByVal propertyName As String, ByVal sortDirection As SortDirection) As {0}Collection
Me.InnerList.Sort(New OrmLib.ObjectPropertyComparer(propertyName))
if sortDirection = SortDirection.Descending then Me.InnerList.Reverse()
Return Me
End Function
Public Function FindBy(ByVal propertyName As String, ByVal searchValue As Object) As {0}
return FindBy(propertyName, searchValue, CompareType.Exact)
End Function
Public Function FindBy(ByVal propertyName As String, ByVal searchValue As Object, ByVal comparer As CompareType) As {0}
Dim _{0} As {0}
For Each _{0} In Me.List
if Match(comparer,_{0}(propertyName) , searchValue) then Return _{0}
Next
Return Nothing
End Function
Public Overloads Function Add(ByVal new{0} As {0}) As System.Int32
Return Me.List.Add(new{0})
End Function
{1}{2}{3}
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -