I am writing a program which needs the namespace of the program but I cant seem to figure out how to retrieve it. I would like the end result to be in a string.
I wa
as a roll upp all post answers: getting all columns' values from a table given as a string tableName:
var tableName = "INVENTORY_PRICE";
var assembly = Assembly.GetExecutingAssembly();
var tip = typeof(Form3);
var t = assembly.GetType(tip.Namespace + "." + tableName);
if (t != null)
{
var foos = db.GetTable(t);
foreach (var f in foos)
{
Console.WriteLine(f + ":");
foreach (var property in f.GetType().GetProperties())
if (property != null)
{
var pv = property.GetValue(f, null);
Console.WriteLine(" " + property.Name + ":" + pv);
}
Console.WriteLine("------------------------------------------------");
}
}
it is very easy if we use ado, this sample uses LINQ context...