You can use JSON to serialize your array. You can use JSON.net like I did. Remember that you cannot pass every string to your Uri - if it contains characters like '&' your app will crash. That's why you have to use Uri.UnescapeDataString.
This an example for 2D string array. If you need to pass complex objects it's still possible to use JSON.net (see the documentation). Just remember to use Uri.UnescapeDataString after serialization.
Before you deserialize your array from JSON you have to unescape it (Uri.UnescapeDataString).
In your source page:
using System;
using System.Net;
using System.Windows;
using Microsoft.Phone.Controls;
using Newtonsoft.Json;
namespace PhoneApp2
{
public static class Extensions
{
public static string GetHtmlDecoded(this string str)
{
return HttpUtility.HtmlDecode(str);
}
public static string GetHtmlEncoded(this string str)
{
return HttpUtility.HtmlEncode(str);
}
}
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
var arrStr = new[,]
{
{"aaaa$ffeaw&fewa=324&fewa", "fewa"},
{"aafw&fewa=324&fewa", "fefewa"},
};
string param = JsonConvert.SerializeObject(arrStr);
param = Uri.EscapeDataString( param);
var destination = new Uri("/Page1.xaml?arr=" + param, UriKind.Relative);
NavigationService.Navigate(destination );
}
}
}
In the destination page:
using System;
using Microsoft.Phone.Controls;
using Newtonsoft.Json;
namespace PhoneApp2
{
public partial class Page1 : PhoneApplicationPage
{
public Page1()
{
InitializeComponent();
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
var param = Uri.UnescapeDataString(NavigationContext.QueryString["arr"]);
var arr = JsonConvert.DeserializeObject<string[,]>(param);
}
}
}