Using Generic Type Aliases in C#

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ก.พ. 2025

ความคิดเห็น • 16

  • @saeedjannati
    @saeedjannati 3 ปีที่แล้ว +2

    Your videos are great. Couple of years ago I watched your TCP IP unity video which saved my life and job back there. So thank you very much and keep up the good work.

  • @PiezPiedPy
    @PiezPiedPy 3 ปีที่แล้ว +3

    Been using C# for years now and never new this feature existed, thx 👍

  • @cashgarman
    @cashgarman 3 ปีที่แล้ว +2

    This is quite useful when you have an ambiguous class name like System.Random and UnityEngine.Random.
    If you actually need to use System and UnityEngine that code, which is quite common, then you can avoid the conflict with: using Random = UnityEngine.Random; (if that's the one you're interested in using).
    Thanks for the video!

  • @aftamat4ik
    @aftamat4ik 11 หลายเดือนก่อน +1

    wow! i was looking for this! thanks!

  • @emilyhorton996
    @emilyhorton996 3 ปีที่แล้ว

    Hey this was super useful! I dunno if I am abusing this or not, but I wanted to have a pair of dictionaries that would store some parameters loaded from a file, sorting everything in two different ways. So I wrote a monstrous generic type that was horribly ugly and made me question if I'm the real villain in all of this. Anyway, I followed this tutorial and the horrible ugliness is now nice and readable! Thanks!

  • @HeavyMix3
    @HeavyMix3 3 ปีที่แล้ว +1

    Great little trick, thanks for sharing!

  • @sdasddsasadad2287
    @sdasddsasadad2287 3 ปีที่แล้ว

    Thanks! it really helped me to learn programming!! 0:50

  • @TheRealFishInABowl
    @TheRealFishInABowl 3 ปีที่แล้ว

    Good stuff!

  • @JasonStorey
    @JasonStorey 3 ปีที่แล้ว +1

    If you like that, wait till you try "using static System.Console" ;P

  • @aryanahire2337
    @aryanahire2337 3 ปีที่แล้ว +1

    var strings = new Strings() {
    "Ayo I'm subscribed already",
    "And I commented"
    };

  • @dougie8747
    @dougie8747 3 ปีที่แล้ว +1

    Nice, I don't have to write `System.DateTime` or `using System;` anymore, just `using DateTime = System.DateTime;`

  • @r1pfake521
    @r1pfake521 3 ปีที่แล้ว

    I wish there was a way to make project wide Type Aliases, they only work for the current file :(
    Would be very helpful for something like named ValueTuples, so you don't have to repeat the Names in every place you want to use the ValueTuple

    • @WorldOfZeroDevelopment
      @WorldOfZeroDevelopment  3 ปีที่แล้ว

      Looks like there's a few conversations about supporting something like that on the dotnet GitHub page.

  • @soulinekki1130
    @soulinekki1130 3 ปีที่แล้ว

    Comment for stats

  • @wendten2
    @wendten2 3 ปีที่แล้ว

    Hell internet! In this video we gonna...