C# Generics - What they are, why they are useful, and how to create them

IAmTimCorey May 7, 2018
Video Thumbnail
IAmTimCorey Logo

IAmTimCorey

@iamtimcorey

About

My goal is to make your life easier, specifically when it comes to learning software development. I remember what it was like to not know even what questions to ask. In every video I do, I try to answer those questions. You will notice that I don't usually do quick videos. That's because I would rather help you understand rather than just padding my watch percentages. If you want more in-depth training, feel free to head over to my website (https://www.iamtimcorey.com) where I have courses dedicated to C#, SQL, and more.

Video Description

Have you ever used a List of T and wondered what the T meant? Or maybe you heard the term generics but you did not really know what that was or why it was important. Maybe you have been using generics for a while but didn't know you could create your own. Whatever the case, this video is for you. In this video, I am going to lay the foundation of what generics are and what makes them so powerful. Then, we will look at a demonstration I have set up on how you can keep your code dry, better conform to the SOLID principles, and make your life easier by implementing generics a class. Source Code: https://www.iamtimcorey.com/downloads/?code=CSharpGenerics Patreon: https://patreon.com/IAmTimCorey Newsletter signup: https://signup.iamtimcorey.com/ 0:00 - Intro 1:33 - Creating a List of T 4:03 - Why not to use ArrayList and why generics are useful 11:10 - Demo app walk through pt1 22:56 - The problem: repetition 28:55 - Solving the repetition with generics; Demo application walk through pt2 47:50 - When to use generics 50:41 - Passing in more than one type of generic

Build Your Own Drone Today

AI-recommended products based on this video

Loading...
Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

(32)
$8.99
FREE delivery Wed, Mar 25 on your first order
Loading...
Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

(34)
$8.70
FREE delivery Fri, Feb 13 on your first order
300+ bought in past month
Loading...
Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

(41)
$8.18
Prime
800+ bought in past month
Loading...
Windshield Crack Repair kit Windshield Repair kit, Glass Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit 2 Pack (Drakgray)
Best Seller

Windshield Crack Repair kit Windshield Repair kit, Glass Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit 2 Pack (Drakgray)

(44)
$9.20
FREE delivery Fri, Oct 24 on your first order
500+ bought in past month
Loading...
Cordless Car Handheld Vacuum: Car Vacuum Cleaner with 16000Pa Ultra-Strong Suction, Brushless Motor & HEPA Filter - Lightweight Design for Drivers and Office Workers - Ashen

Cordless Car Handheld Vacuum: Car Vacuum Cleaner with 16000Pa Ultra-Strong Suction, Brushless Motor & HEPA Filter - Lightweight Design for Drivers and Office Workers - Ashen

(34)
$49.98
FREE delivery Sat, Apr 11
Loading...
Compressed Air Duster-380000RPM Super Power Electric Air Duster, Rechargeable Brushless Motor Durable Blower for Fast Charging, Adjustable Mini Blower for House,Outdoors,Car

Compressed Air Duster-380000RPM Super Power Electric Air Duster, Rechargeable Brushless Motor Durable Blower for Fast Charging, Adjustable Mini Blower for House,Outdoors,Car

(32)
$66.66
FREE delivery Jan 21 - Feb 10Only 9 left in stock.
Loading...
Long Range Super Endurance Foldable Drone with Camera for Beginners–36+ min Flight Time, WiFi FPV Quadcopter with 2K HD Camera, Brushless Motor, Auto Hover, Follow Me (2 Batteries)

Long Range Super Endurance Foldable Drone with Camera for Beginners–36+ min Flight Time, WiFi FPV Quadcopter with 2K HD Camera, Brushless Motor, Auto Hover, Follow Me (2 Batteries)

(206)
$88.98
FREE delivery Sun, Nov 30
1K+ bought in past month
Loading...
NAFYRE N11 PRO GPS Drone with Camera for Adults 4K UHD, 90 Min Long Flight Time, Long Control Range, Auto Return, Follow Me, Brushless Motor, 5G FPV RC Quadcopter for Beginners

NAFYRE N11 PRO GPS Drone with Camera for Adults 4K UHD, 90 Min Long Flight Time, Long Control Range, Auto Return, Follow Me, Brushless Motor, 5G FPV RC Quadcopter for Beginners

(108)
$149.98
FREE delivery Wed, Aug 20
100+ bought in past month
Loading...
Long Range Super Endurance Foldable Drone with Camera for Beginners–36+ min Flight Time, WiFi FPV Quadcopter with 2K HD Camera, Brushless Motor, Auto Hover, Follow Me (2 Batteries)

Long Range Super Endurance Foldable Drone with Camera for Beginners–36+ min Flight Time, WiFi FPV Quadcopter with 2K HD Camera, Brushless Motor, Auto Hover, Follow Me (2 Batteries)

(206)
$88.98
FREE delivery Sun, Nov 30
1K+ bought in past month
Loading...
Super Enduring Brushless Motor Drone with Camera for Beginners, CHUBORY A68 WiFi FPV Quadcopter with 2K HD Camera, Auto Hover, 3D Flips, Headless Mode, Trajectory Flight

Super Enduring Brushless Motor Drone with Camera for Beginners, CHUBORY A68 WiFi FPV Quadcopter with 2K HD Camera, Auto Hover, 3D Flips, Headless Mode, Trajectory Flight

(1,063)
$89.99
FREE delivery Wed, Aug 20
Loading...
NAFYRE N11 PRO GPS Drone with Camera for Adults 4K UHD, 90 Min Long Flight Time, Long Control Range, Auto Return, Follow Me, Brushless Motor, 5G FPV RC Quadcopter for Beginners

NAFYRE N11 PRO GPS Drone with Camera for Adults 4K UHD, 90 Min Long Flight Time, Long Control Range, Auto Return, Follow Me, Brushless Motor, 5G FPV RC Quadcopter for Beginners

(108)
$149.98
FREE delivery Wed, Aug 20
100+ bought in past month
Loading...
FERIETELF Drone with Camera - T26 RC Drones for Adults with 1080P HD Live Video, FPV Drone with 24mins Flight/Altitude Hold/Headless Mode/Gravity Sensor for Kids Beginners

FERIETELF Drone with Camera - T26 RC Drones for Adults with 1080P HD Live Video, FPV Drone with 24mins Flight/Altitude Hold/Headless Mode/Gravity Sensor for Kids Beginners

(13)
$99.99
PrimeFREE delivery Sat, Jun 14
Loading...
GTOCE Portable Charger,40000mAh Power Bank with 22.5W Fast Charging LED Digital Display Battery Pack with 6 Outputs 2 Inputs, Type C Powerbank Portable Charger for iPhone 16 pro Samsung AirPods,Black

GTOCE Portable Charger,40000mAh Power Bank with 22.5W Fast Charging LED Digital Display Battery Pack with 6 Outputs 2 Inputs, Type C Powerbank Portable Charger for iPhone 16 pro Samsung AirPods,Black

(334)
$42.99
FREE delivery Thu, Oct 16
1K+ bought in past month
Loading...
DXKK Controller Battery Pack for Xbox Series X|S with Touch Switch, Rechargeable Battery for Xbox One/S/X/Elite Controller Charger Station Video Game Case

DXKK Controller Battery Pack for Xbox Series X|S with Touch Switch, Rechargeable Battery for Xbox One/S/X/Elite Controller Charger Station Video Game Case

(43)
$72.16$71.65
FREE delivery Aug 26 - 28
Loading...
3x5520mWh Battery Pack Compatible for Xbox One/Xbox Series X/S Controller, Rechargeable Battery Packs for Xbox One S/One X/One Elite Accessories

3x5520mWh Battery Pack Compatible for Xbox One/Xbox Series X/S Controller, Rechargeable Battery Packs for Xbox One S/One X/One Elite Accessories

(4,294)
$78.80$75.60
FREE delivery Aug 26 - 28
Loading...
2 Pack Controller Battery Pack Rechargeable for Xbox One/Xbox Series X|S with 4 Battery Cover Xbox Play and Charge Kit with Micro USB Charging Cable for Xbox One S/X/Elite Controller

2 Pack Controller Battery Pack Rechargeable for Xbox One/Xbox Series X|S with 4 Battery Cover Xbox Play and Charge Kit with Micro USB Charging Cable for Xbox One S/X/Elite Controller

(355)
$36.99
FREE delivery Sun, Aug 24
Loading...
Nulaxy 54W [PD 36W & QC3.0 18W] Bluetooth 5.3 Car Adapter with 4 Charging Ports, Wireless Radio FM Transmitter Audio Receiver with Deep Bass MP3 Music Player, 5 Colors LED Backlit, Hands-Free Calling
Best Seller

Nulaxy 54W [PD 36W & QC3.0 18W] Bluetooth 5.3 Car Adapter with 4 Charging Ports, Wireless Radio FM Transmitter Audio Receiver with Deep Bass MP3 Music Player, 5 Colors LED Backlit, Hands-Free Calling

(4,459)
$19.79
FREE delivery Mon, Aug 25 on your first order
2K+ bought in past month
Loading...
Nulaxy Bluetooth FM Transmitter for Car, Upgraded QC3.0 & 5V 1A Dual USB Charger Bluetooth Car Adapter Wireless Radio, 7-Color LED Backlit Light, Hands-Free Calling, Support USB Drive TF Card - NX10

Nulaxy Bluetooth FM Transmitter for Car, Upgraded QC3.0 & 5V 1A Dual USB Charger Bluetooth Car Adapter Wireless Radio, 7-Color LED Backlit Light, Hands-Free Calling, Support USB Drive TF Card - NX10

(18,436)
$18.69$17.38
FREE delivery Sat, Jan 3 on your first order
1K+ bought in past month