EX-23.(B) 5 a2169792zex-23_b.htm EXHIBIT 23(B)
QuickLinks -- Click here to rapidly navigate through this document

Exhibit 23B


CONSENT OF INDEPENDENT REGISTERED
PUBLIC ACCOUNTING FIRM

        We consent to the incorporation by reference in this Registration Statement on Form S-4 of Mercantile Bankshares Corporation of our report dated January 27, 2006 relating to our audits of the consolidated balance sheets of James Monroe Bancorp, Inc. and Subsidiaries as of December 31, 2005 and 2004, and the related consolidated statements of income, changes in stockholders' equity and cash flows for the years ended December 31, 2005, 2004 and 2003, which appear in the Annual Report on Form 10-K of James Monroe Bancorp, Inc. for the year ended December 31, 2005.

        We also consent to the reference to our firm under the caption "Experts" in the Prospectus, which is part of this Registration Statement.

/s/ Yount, Hyde & Barbour, P.C.

Winchester, Virginia
May 24, 2006

2




QuickLinks

CONSENT OF INDEPENDENT REGISTERED PUBLIC ACCOUNTING FIRM