Explain Generics in C# ? When and why to use them ?

  Рет қаралды 27,516

Interview Happy

Interview Happy

Күн бұрын

Пікірлер: 37
@sreenubabusreeram
@sreenubabusreeram 3 ай бұрын
2:13 Hi Happy Sir, Integer to object involves boxing it is ok then is it string to object is not involve boxing I think is it correct or not but i agree with convertion i ask this question because of string also reference type and object also reference type then how boxing is possible?
@nithin-j2e
@nithin-j2e 4 ай бұрын
simple and straight
@KIRANKUMAR-mn6rw
@KIRANKUMAR-mn6rw 2 жыл бұрын
how do equate class using generics? say u have class A with set of properties and class B with other set of properties so now how do u compare?
@interviewhappy
@interviewhappy 2 жыл бұрын
Hi Kiran, I think object.Equals and with generics this IEquatable will do what you are asking.
@ssmcs060
@ssmcs060 2 жыл бұрын
Apart from object, cant we use method overloading?
@interviewhappy
@interviewhappy 2 жыл бұрын
Yes Sampat you are right, but then you have to write more lines of code for new overloaded methods which is a overhead then.
@ssmcs060
@ssmcs060 2 жыл бұрын
@@interviewhappy hummmm. I was also started thinking this lately. If 2 such methods exist then results in 4 methods.
@vinaybammidi7123
@vinaybammidi7123 2 жыл бұрын
Thank you. Very useful. Generic are necessary.
@interviewhappy
@interviewhappy 2 жыл бұрын
Welcome Vinay
@sribardhansimhadri3613
@sribardhansimhadri3613 2 жыл бұрын
Very Nice Explanation
@shreedharrs9540
@shreedharrs9540 Жыл бұрын
Pls make a video of framework automation it is helpful every one pls do it asap
@interviewhappy
@interviewhappy Жыл бұрын
Sure, I will try, but it might take some time. All the best.
@lakshmisony8803
@lakshmisony8803 4 ай бұрын
So in generic class we have to define static class only.is'tit?
@rohitharajayalakshmi6729
@rohitharajayalakshmi6729 3 ай бұрын
no for static also -- for class generic using System; public class HelloWorld { public static void Main(string[] args) { cal c = new cal(); int str = c.AreEqual(3,3); cal cl = new cal(); string str1 =cl.AreEqual("r","r"); Console.WriteLine(str); Console.WriteLine(str1); Console.ReadLine(); } public class cal { public T AreEqual(T x, T y) { return x; } } } -- for method generic using System; public class HelloWorld { public static void Main(string[] args) { cal c = new cal(); int str = c.AreEqual(3,3); string str1 =c.AreEqual("r","r"); Console.WriteLine(str); Console.WriteLine(str1); Console.ReadLine(); } public class cal { public T AreEqual(T x, T y) { return x; } } }
@deepakgupta5733
@deepakgupta5733 2 жыл бұрын
What does generics internally use?
@interviewhappy
@interviewhappy 2 жыл бұрын
Good question Deepak. I will get back on this and if you know, then you can share.
@danielroma2370
@danielroma2370 Жыл бұрын
Good explanation, thank you!
@interviewhappy
@interviewhappy Жыл бұрын
Glad it was helpful! Daniel
@Khushi-FoodPlaza
@Khushi-FoodPlaza 7 ай бұрын
Please make video on array 😢real time projects pls
@sahaksargsyan7397
@sahaksargsyan7397 Жыл бұрын
Hello Happy, it will be nice, if you make video about inheritance from generic class. Thank you
@madhavikiran6920
@madhavikiran6920 2 жыл бұрын
Can you make video on Generic collection?
@interviewhappy
@interviewhappy 2 жыл бұрын
Sure Madhavi
@bandarapurajashekarreddy1692
@bandarapurajashekarreddy1692 Жыл бұрын
Please do video on Reflection in c#
@interviewhappy
@interviewhappy Жыл бұрын
Sure Raja, soon I will
@leelanp
@leelanp 2 жыл бұрын
good explanation
@interviewhappy
@interviewhappy 2 жыл бұрын
Thanks Leela
@imadabab
@imadabab Жыл бұрын
Good explanation. Thanks.
@interviewhappy
@interviewhappy Жыл бұрын
You're welcome!
@prabhatkumar353
@prabhatkumar353 Жыл бұрын
Thanku sir Nice explanation
@interviewhappy
@interviewhappy Жыл бұрын
Always welcome @prabhat
@kaniyansai
@kaniyansai Жыл бұрын
Very very useful
@interviewhappy
@interviewhappy Жыл бұрын
Glad you think so@ kaniyansai
@poojachavan396
@poojachavan396 Жыл бұрын
Can you make video on Entity framework core interview questions?
@interviewhappy
@interviewhappy Жыл бұрын
I added some questions of EF but not all. May be in future I will add them.
@manieditz3012
@manieditz3012 11 ай бұрын
Thank you sir
@vipulshrivastava1069
@vipulshrivastava1069 8 ай бұрын
Set video paly speed to 1.25
@rajumechanicalhub5805
@rajumechanicalhub5805 Жыл бұрын
Tq sir
Can we execute multiple Catch blocks ?
1:42
Interview Happy
Рет қаралды 10 М.
Understand your C# queries! IEnumerable & IQueryable in explained
11:28
tutorialsEU - C#
Рет қаралды 40 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 25 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 656 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 14 МЛН
What is a Constructor and what are its types ?
11:11
Interview Happy
Рет қаралды 11 М.
C# generics ⁉️
5:33
Bro Code
Рет қаралды 81 М.
SOLID  Principal - Interview Questions and Answers
24:04
Interview Happy
Рет қаралды 126 М.
Explain IEnumerable in C# ( C# Interview Questions)
8:40
Questpond
Рет қаралды 50 М.
Learn TypeScript Generics In 13 Minutes
12:52
Web Dev Simplified
Рет қаралды 288 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 275 М.
7 C# Tips and Tricks to impress your .NET Developer friends
7:48
How many people are in the changing room? #devil #lilith #funny #shorts
00:39