What are Extension Methods in C#? When to use them?

Поделиться
HTML-код
  • Опубликовано: 4 авг 2024
  • 1. Full .NET Interview Course
    C# / ASP.NET Core / MVC / API - Top 500 Interview Questions
    www.udemy.com/course/csharp-o...
    Don't worry if course not helping you, Udemy has 30 days Free Refund Policy.
    2. Quick Revision Book (PDF format)
    Top 500 .NET Interview Questions - OOPS/ C#/ ASP.Net/ MVC/ SQL /.Net Core /Web API
    imojo.in/interviewhappy
    50% Discount Applied on above link.
    Don't worry if book not helping you, I will return 100% of your money with in 7 days of purchase. Just mail me at anuragrawat123@gmail.com.
    My best wishes are with you.

Комментарии • 16

  • @WaqasMehmood-nq5uz
    @WaqasMehmood-nq5uz 2 месяца назад +1

    test.RightSubstring(5) means count = 5 in RightSubSting(this String s , count)
    then
    return s.Substring(s.length-count , count)
    (10-5 , 5) => (5,5)
    then how it will print " World "

  • @LAUGHTERSumen_007
    @LAUGHTERSumen_007 Год назад +1

    This much it was easy I was not knowing you are great to make people understand.

    • @interviewhappy
      @interviewhappy  Год назад +1

      Thanks Umang. Your name matches your comments.

  • @yogeshvedpathak8837
    @yogeshvedpathak8837 Год назад +2

    As you mentioned add new methods in existing class then why you created separate class for extension method.?

  • @TheKumarer
    @TheKumarer Год назад

    nice explanation . keep it up it help to us learning every concept

  • @way02learn
    @way02learn Год назад +1

    Thanks for your help,have a quick question ,How IIS work with Task and Thread in c#?

    • @interviewhappy
      @interviewhappy  Год назад

      Good question Amit. I don't have a simple answer for this. But for this I think we have to understand multi-threading, multi-processing first. I will create one question on this in future.

  • @abhiabhilash9615
    @abhiabhilash9615 2 года назад +2

    Thanks for making videos , these videos are very helpful for interview preparation ,
    have a quick question , how this key word is working in static class in case of extension methods?

    • @interviewhappy
      @interviewhappy  2 года назад +2

      Hi Abhi, very good question, in extension methods, this keyword will bind that particular method with the class mentioned with this keyword.
      public static void M1(this Student g, string str)
      Above M1 method will be bind to the Student class as it is prefixed by this keyword. Rest of parameters like str are just normal parameters.

    • @abhiabhilash9615
      @abhiabhilash9615 2 года назад +1

      @@interviewhappy really thank you for your quick response. Really thankful for making these video’s. Keep doing great job

    • @nidhinshaji7197
      @nidhinshaji7197 4 месяца назад

      Can you please explain the logic of Right substring method.
      There the count should be 5 right. So it will print world.
      What will be the output if the initial string was "HelloWorldGuys".
      Then also it will print "World" only right or "WorldGuys"?

  • @sonuuniyal502
    @sonuuniyal502 Год назад +2

    Sir please create a video on abstraction and encapsulation

    • @interviewhappy
      @interviewhappy  Год назад +1

      Sure Uniyal ji... All the best for you career.

  • @User-Dotnet
    @User-Dotnet Год назад +1

    Hi Happy Please make vedio on Anonymous types and Anonymous methods.