using System.Collections;
using System.Collections.Generic;
using Microsoft.SqlServer.Types;
using System.Data.SqlTypes;
public static void Main()
Console.WriteLine("SqlGeography serialization ");
var writer = new StringWriter();
dt.WriteXmlSchema(writer);
Console.WriteLine(writer.ToString());
static DataTable GetGeoTable()
DataTable dataTable = new DataTable("table");
dataTable.Columns.Add("f1", typeof(SqlGeography));
dataTable.Columns.Add("id", typeof(int));
DataRow newRow = dataTable.NewRow();
newRow["f1"] = SqlGeography.Point(20, 10, 4326);
dataTable.Rows.Add(newRow);
newRow = dataTable.NewRow();
newRow["f1"] = SqlGeography.Point(30, 15, 4326);
dataTable.Rows.Add(newRow);
foreach (DataRow row in dataTable.Rows)
string ID = row["id"].ToString();
string f1 = row["f1"].ToString();
Console.WriteLine("{0} {1}", ID, f1);