AçıKLANAN C# ILIST NERELERDE KULLANıLıYOR HAKKıNDA 5 KOLAY GERçEKLER

Açıklanan C# IList Nerelerde Kullanılıyor Hakkında 5 Kolay Gerçekler

Açıklanan C# IList Nerelerde Kullanılıyor Hakkında 5 Kolay Gerçekler

Blog Article

The above is an IList itself kakım this is what seems to be the standard to use with nhibernate. Otherwise I might have returned IEnumberable back but hamiş sure. Still, I kişi't figure out what the user would 100% need(that's where returning a concrete has an advantage over).

Found this thread while I was looking for a solution to the exact mesele described in the original post. None of the answers met my situation entirely, however. Brody's answer was pretty close. Here is my situation and solution I found to it.

Interface’ler için henüz ziyade bilgi peyda etmek isterseniz, hordaki kaynaklara bölüm atabilirsiniz:

Eric LippertEric Lippert 656k182182 gold badges1.3k1.3k silver badges2.1k2.1k bronze badges 14 12 How do you know what the caller needs though. For instance I was switching one of my return types to a IList then I well I am probably just going to enumerate over them anyways lets just return an IEnumberable.

In addition to the older code that doesn't know about generics, there are also a lot of cases where you know you have a list

so its safety for you and freedom to the coder who is writing concrete C# IList Nerelerde Kullanılıyor implementation to change or add more functionality to his concrete class.

You are most often better of using the most general usable type, in this C# IList Nasıl Kullanılır case the IList or even better the IEnumerable interface, so that you kişi switch the implementation conveniently at a later time.

IList is an Interface, not a class. If you want to initialize it, you need to initialize it to a class that implements IList, depending on your specific needs internally. Usually, IList is initialized with a List.

If you started with a concrete type and you decided to change to another one, even if it uses the same interface, you're going to break someone else's code unless you started off with an interface or abstract base type. Share Improve this answer Follow

class Kisi string ad; string soyad; public string Ad get return ad; seki ad = value; public string Soyad get return soyad; seki soyad = value;

Bir ahir elementin varlığını sınayan MoveNext ve uygulanan elementi veren GetCurrent C# IList Nerelerde Kullanılıyor metodlarına sahiptir.

Less ridiculous way to prove C# IList Nerelerde Kullanılıyor that an Ascii character compares equal with itself in Coq more hot questions

If you use a concrete implementation of list, another implementation of the same list will derece be supported by your code.

It doesn't affect the signature of the method, and is takım in stone at compile time. You should instead be helping C# IList Nedir him get over his confusion about declaring his local like IList foo = new List - this is where his confusion clearly lies.

Report this page