Identifying the correct leg of a transistor or MOSFET

Picture of Identifying the correct leg of a transistor or MOSFET
Sometimes it is not obvious which leg of a transistor does what, obviously you cant just plug in the transistor and take a guess at which legs is the Base, Collector or Emitter it would just damage the transistor. 

So a quick method I use for identifying transistor legs is to lookup the datasheet, get a black permanent marker and mark the base of the transistor, I remember by Black for Base. (Picture 1, Left)

With a black PNP transistor you cant make a visible mark with a black marker so I get some sticky paper, make it the appropriate size for the transistor and mark on the letters C, B, E corresponding to the pin out of the datasheet. Bear in mind if you stick it to the back of the transistor the pin out is opposite to what it says on the datasheet that is why it reads C,B,E where the datasheet says E,B,C.  I stuck it on the back of the transistor so it does not obstruct the part number, I may need it to reference the transistor later. (Picture 1, Middle)

With a power MOSFET where the legs cannot  simply be inserted into a breadboard, check the datasheet confirm the pin out and then get some solid core wire of 3 different colours and solder them onto the MOSFET, the colour code I use is Green for the Gate, Red for the Drain and Black for the source (on a N type MOSFET). (Picture 1, Right)

CAUTION! If your transistor is ESD sensitive dont forget to wear your ESD wriststrap or Ground yourself by touching a radiator or metal case of a computer.