MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Imports System.Globalization Public Class Sheet Public Shared Sheets As New Dictionary(Of Integer, Sheet) Private Property Sheet As Integer Public Property Members As List(Of Member) Public Sub New(sheet As Integer) Members = New List(Of Member) Me.Sheet = sheet End Sub ''' <summary> ''' Generates the total weight of a sheet when the type of member ''' is passed to the function ''' </summary> ''' <param name="memberType">The type of member on a sheet, i.e. "Ladder", "Stair", etc</param> ''' <returns>Returns as a double the total weight of all members on a sheet for the MemberType</returns> ''' <remarks></remarks> Public Shared Function WeightByType(memberType As String) As Decimal Dim subset = Sheets.Where( Function(kvp As KeyValuePair(Of Integer, Sheet)) _ kvp.Value.Members.Count(Function(m) m.MemberType = memberType) > 0) subset.ToList().ForEach( Sub(kvp As KeyValuePair(Of Integer, Sheet)) _ WeightByType += (kvp.Value.Members.Sum( Function(m As Member) _ Convert.ToDecimal(m.TotalWeight, CultureInfo.InvariantCulture)))) End Function End Class
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.