linqlike cast and to_map