Civil 3D has different ways to store custom data on different objects. On the specific case of Network Parts (Pipe or Structure), a user can store custom property values as described on this blog post. In this case, the information is stored under the Part.PartData property, that contains a list/array of PartDataField objects. An easy way to output this data is using the code below:
[CommandMethod("pipedatafield")]
public static void CmdSelectPipe()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect network part: ");
peo.SetRejectMessage("\nOnly network parts");
peo.AddAllowedClass(typeof(Part), false);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
ObjectId partId = per.ObjectId;
Database db = Application.DocumentManager.MdiActiveDocument.Database;
using (Transaction trans = db.TransactionManager.StartTransaction())
{
Part p = trans.GetObject(partId, OpenMode.ForRead) as Part;
PartDataField[] fields = p.PartData.GetAllDataFields();
foreach(PartDataField field in fields)
{
ed.WriteMessage("\n{0}: {1}", field.Description, field.Value);
}
}
}