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.
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 "
This much it was easy I was not knowing you are great to make people understand.
Thanks Umang. Your name matches your comments.
As you mentioned add new methods in existing class then why you created separate class for extension method.?
nice explanation . keep it up it help to us learning every concept
Thank you, I will try my best @ Thekumarer
Thanks for your help,have a quick question ,How IIS work with Task and Thread in c#?
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.
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?
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.
@@interviewhappy really thank you for your quick response. Really thankful for making these video’s. Keep doing great job
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"?
Sir please create a video on abstraction and encapsulation
Sure Uniyal ji... All the best for you career.
Hi Happy Please make vedio on Anonymous types and Anonymous methods.
Okay sure will try jan