I am new to wp7 programming and i would like to know how can i store all contacts which include first name, last name, email and phone number in json fomat from a wp7. By now i am able to read these things and store in isolated storage file but i need them as Json.
Thanks in advance, any help would be appreciated.
hi this is my code but now i am facing problem to get values from data memebers of class mycontacts such that it can be passed to json serializer. Can you please help me in this. I want to store the values in object such that it can be converted to using the way you gave.
private void ButtonContacts_Clk(object sender, RoutedEventArgs e) { Contacts cContacts = new Contacts(); cContacts.SearchCompleted += new EventHandler(ContactsSearch); cContacts.SearchAsync(String.Empty, FilterKind.DisplayName, null); }
void ContactsSearch(object sender, ContactsSearchEventArgs e)
{
for (int i = 0; i < e.Results.Count(); i++)
{
var ContactsData = from m in e.Results
select new mycontacts
{
DisplayName = m.DisplayName,
PhoneNumber = m.PhoneNumbers.FirstOrDefault()
};
}
}
}
public class mycontacts
{
public String fname { get; set; }
public String lname { get; set; }
public String DisplayName { get; set; }
public String[] email { get; set; }
public Phone[] phone_num;
}
public class Phone
{
public String number { get; set; }
public int type { get; set; }
}