public static Task <RoomInfo[]> ListRoomsAsync(this Multiplayer multiplayer, string roomType, Dictionary <string, string> searchCriteria, int resultLimit, int resultOffset) { var tcs = new TaskCompletionSource <RoomInfo[]>(); multiplayer.ListRooms(roomType, searchCriteria, resultLimit, resultOffset, tcs.SetResult, tcs.SetException); return(tcs.Task); }