I have a class to hold data and a list of that class.
Here is my code.
static void Main(string[] args)
{
List<GoogleContacts> contacts = new List<GoogleContacts>();
contacts.Add(new GoogleContacts { title = "A", email = "B", im = "X" });
contacts.Add(new GoogleContacts { title = "C", email = "D", im = "Y" });
contacts.Add(new GoogleContacts { title = "E", email = "F", im = "Z" });
}
}
public class GoogleContacts
{
public string title { get; set; }
public string email { get; set; }
public string im { get; set; }
}
I want to save those data in a .VCF file in local Disk.
Just create a StringBuilder instance and write the contents of the .VCF to it.
Afterwards you can save it to a file using the static WriteAllText(…) method of the File type.
Just open a .vcf file with a text editor to explore its contents. Since you only require a couple of properties it should be easy to figure out.
A small example:
If you want to include an image you have to base 64 encode it.