Q: Why do we use tuple in C#?

A: Basically, when we want to return multiple values like servicefee, markup, and coupon amount without using any class, then we can use a tuple to return all three values at once from a method. Here is the programming snapshot.
How to create a method
  1. public static (float servicefee, float discount, float couponamount) GetAppliedAmount(float totalservicefee, float totalDiscount, float totalcouponamount)
  2. {
  3. return (totalservicefee , totalDiscount, totalcouponamount);
  4. }
How to use this method
  1. Public void GetAmount()
  2. {
  3. var calculatedamount= GetAppliedAmount(totalservicefee, totalDiscount, totalcouponamount);
  4. float discount= calculatedamount.servicefee;
  5. float discount= calculatedamount.discount;
  6. float discount= calculatedamount.couponamount;
  7. }
Here are some more - Tuples In C#