This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$object = new Object(); | |
$count = array_sum(array_map(function($x) { | |
$count = array_sum(array_map(function($y) { return count($y->propertyOfAnotherObject); }, $x->anotherObjectInsideObject)); | |
return $count; | |
}, $object)); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function ToDictionary() As Dictionary(Of String, Object) | |
Dim dictionary As Dictionary(Of String, Object) = New Dictionary(Of String, Object) | |
For Each property_info As Reflection.PropertyInfo In [GetType].GetProperties() | |
Try | |
Console.WriteLine("name: " + property_info.Name + " value: " + property_info.GetValue(Me, Nothing).ToString) | |
dictionary.Add(property_info.Name, property_info.GetValue(Me, Nothing).ToString) | |
Catch ex As Exception | |
dictionary.Add(property_info.Name, ex.Message) | |
End Try |