Let me count...
NES:
-Super Mario Bros 1
-Super Mario Bros 2
-Super Mario Bros 3
SNES:
-Super Mario All stars
-Super Mario World (technically, I have it in the SM all stars + SMW cartdrige, but it´still counts)
-Super Mario Kart
-Yoshi´s Island
GB/ GBC:
-Super Mario Land 1
-Super Mario Land 2
-Wario Land 1 (or SML3, whatever...)
-Wario Land 2
-Wario Land 3
-Super Mario Bros Deluxe
-Donkey Kong 94
N64:
-Super Mario 64
-Yoshi´s Story
-Mario Party 3
-Mario Kart 64
-Mario Tennis 64
GBA:
-Yoshi´s Island GBA (or SMA3, lol)
-Mario Kart Super Circuit
-Mario Golf Advance Tour
-Mario Tennis Power Tour
-Mario & Luigi Superstar Saga
-Wario Land 4
-Warioware Twisted (import FTW)
-Mario vs Donkey Kong
GCN:
-Super Mario Sunshine
-Luigi´s Mansion
-Wario World
-Warioware Mega Party Games
-Mario Party 4
-Mario Party 7
-Paper Mario 2
-Mario Golf Toadstool Tour
-Mario Power Tennis
-Mario Kart Double Dash
-NDS:
-Super Mario 64 DS
-Mario & Luigi Partners in Time
-Super Princess Peach
-Mario Kart DS
-Mario Basketball (since it has a different name in each region, let´s just simply call it "Mario Basket")
-New Super Mario Bros
-Wii (hell yeah, 2 weeks ago I was finally able to purchase it with a couple games... second hand though but I´m not picky about that sort of things):
-Super Mario Galaxy
-Mario Party 8
-Super Paper Mario
That makes 45 Mario games. 36 if you discount the Wario and Yoshi games, although I still listed them because they are sister series with the Mario games, so, unlike DK which has his own universe (although still closelly tied to Mario) Wario and Yoshi games are pretty much "Mario games starring someone else from the Mario series". The only games that truly feel like a different thing are the Warioware ones, but whatever.
In case you´re wondering, if you want to count the DK games I have, they are the SNES DKC trilogy, DK64, and the already listed Mario vs DK games (the old school one for the GB, and the GBA one). That makes 4 DK games I didn´t list as Mario games, so, if you count them in the list too, that makes 49 Mario games (or at least, games regarding the Mario-verse, lol).
To sort things out:
-49 Mario games as a whole
-45 if I discount DK´s own games
-36 If I discount the Wario platformers and Warioware games.
-33 If I discount Yoshi´s own games
Also, do not hate me for not having Super Mario RPG. Note that I´m from Spain, in Europe, and SMRPG was not released in Europe in it´s time. I have beaten it in emulator but I didn´t count it because I don´t have it legit, although I´m planing to buy an import original copy of it with a PAL adaptor some time (I could always download it for the Wii on the virtual console, but I´m a bit of a collector, so it´s not the same to have the bare ROM when I could buy the entire thing).
About other games, I have tried or fully beaten them either from rentals or by my friends handling me their copies for a few days. That´s how I beat other Mario games I do not have such as Paper Mario 1 (another one I´m planning to buy), the other Mario Parties I do not have, Diddy Kong Racing, etc etc. The only one I had and sold is Yoshi´s Island DS which I highly regret, even if it wasn´t as good as the SNES one and had unfair difficulty. I am very selective with what I buy because I do not want to sell what I buy (see? My little collector side), so I never buy a game that I think it´s not really worth it to keep for eternity lol. Yoshi´s Island DS is the only exception, in that I sold it and I truly regret it. I´ll buy it again eventually.
Also, there are a couple of other Mario games I don´t have, but it´s not like I don´t like them, just that I never had the money or chance to buy them, but although I do like to keep what I have, I´m not obsessed with owning every single Mario game in existence. Plus, it´s obvious that money doesn´t grow on trees, lol.
EDIT:
Oh wait, I also have Game and Watch Gallery 2 and 3. I just count them as G&W series games, but if we count them as Mario games for having Mario and co involved in the modern versions, then I have 51 Mario games, not 49 :P