public void GetBlockTableRecords()
 {
     using (Transaction trx = Db.TransactionManager.StartTransaction())
     {
         BlockTable bt     = Db.BlockTable();
         var        blocks = bt.GetBlockTableRecords();
         foreach (var blk in blocks)
         {
             Ed.WriteLine($"Contains {blk.GetObjectIds().Count()} this many entities in BlockTableRecord");
         }
     }
 }
        public void GetBlockTableRecordsOpenForReadAndXrefBlocks()
        {
            using (Transaction trx = Db.TransactionManager.StartTransaction())
            {
                BlockTable bt     = Db.BlockTable();
                var        blocks = bt.GetBlockTableRecords(OpenMode.ForRead, SymbolTableRecordFilter.IncludeDependent);

                foreach (var blk in blocks)
                {
                    Ed.WriteLine($"Contains {blk.GetObjectIds().Count()} this many entities in BlockTableRecord");
                }
            }
        }
 /// <summary>
 /// Gets the block table records.
 /// </summary>
 /// <param name="symbolTbl">The symbol table.</param>
 /// <param name="mode">OpenMode</param>
 /// <param name="filter"><see cref="SymbolTableRecordFilter"/>.</param>
 /// <returns>IEnumerable{BlockTableRecord}</returns>
 /// <example>
 /// <code source=".\Content\Samples\Samplescsharp\AcDbMgdExtensions\DatabaseServices\BlockTableExtensionsCommands.cs" language="cs" region="GetBlockTableRecords" />
 /// <code source=".\Content\Samples\Samplesvb\AcDbMgdExtensions\DatabaseServices\BlockTableExtensionsCommands.vb" language="VB" region="GetBlockTableRecords" />
 /// </example>
 public static IEnumerable <BlockTableRecord> GetBlockTableRecords(this BlockTable symbolTbl,
                                                                   OpenMode mode = OpenMode.ForRead, SymbolTableRecordFilter filter = SymbolTableRecordFilter.None)
 {
     return(symbolTbl.GetBlockTableRecords(symbolTbl.Database.TransactionManager.TopTransaction, mode, filter));
 }