Sei sulla pagina 1di 40

8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search… SM

C# Best Practices: Collections and Generics


by Deborah Kurata

Resume Course

Bookmarked Add to Channel Download Course

Table of contents Description Transcript Exercise files Discussion Learning Ch

221 Comments Pluralsight Course Discussions 


1

 Recommend 12 t Tweet f Share Sort by N

Join the discussion…

LOG IN WITH
OR SIGN UP WITH DISQUS ?

Name

Paulo Zacarias • 5 months ago


Hi,

I'm having troubles replicating the test in Generic Dictionaries : Initializing a Dictionary of Obje

Everything seems as in the video, but I keep getting the error 'CollectionAssert.AreEqual fa
(Element at index 0 do not match.)'.
Skip to main content
What I'm missing?

Link to repository: https://github.com/paulo-za...


△ ▽ • Reply • Share ›

Stefan Nychka Mod > Paulo Zacarias • 5 months ago

Hi Paulo! It doesn't look in your commit like you overrode the Equals method, etc. like
Deborah mentioned for the Lists comparison.

You need to, I'm pretty sure, override Equals and other methods as described (I think e
the course) in the Vendor class. Should apply the same for objects in a Dictionary as it
for in a List.
Pluralsight uses cookies. Learn more about your privacy
1△ ▽ • Reply • Share ›

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 1/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Paulo Zacarias > Stefan Nychka • 5 months ago


Search…
Hi Stefan,
SM

You are right. Since I started with dictionaries I missed the override of Equals d
lists chapter.

Thank you!
1△ ▽ • Reply • Share ›

Deborah Kurata > Paulo Zacarias • 5 months ago


I'm about to get on a plane ... so if no one else jumps in ... I'll take a look tomorrow.
△ ▽ • Reply • Share ›

Linda Fuchs • 5 months ago


Hey Deborah, I am just getting started with this course and forked the starting source code to
github repository.
However when running the tests for the first time, one of the tests don't pass, which contradic
you say in (2) Introduction -> Sample Application (2:19).

Ive added a screenshot of the code below:

Skip to main content

Pluralsight uses cookies. Learn more about your privacy

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 2/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search… SM

△ ▽ • Reply • Share ›

Deborah Kurata > Linda Fuchs • 5 months ago


Thank you for reporting this.

I updated the repo with the current year + 1 instead of a hard-coded year to better pas
test into the future.

You can find the update here: https://github.com/DeborahK...


2△ ▽ • Reply • Share ›

Stefan Nychka Mod > Linda Fuchs • 5 months ago • edited

Hi Linda!

Just confirming, you were reporting this issue more than asking for help with it right?

It looks to me like you're correct, and like likely it'd work up until about October 25 last
But not now. One fix would be to bump the date at https://github.com/DeborahK... ahe
some point in the future (e.g., change the 2018 to 2019). Ignore if you were just report
will put here in case others come across this as it's a likely workaround.

Deborah is away but will be able to address when she returns (and perhaps before).

P.S. If you do need help, please confirm, and I'll help out more if I can. I am on a Mac,
think properly setting this course up won't work easily, or at all, but I should be able to
further nonetheless. And, others may be able to help out in the meantime too!
2△ ▽ • Reply • Share ›
Skip to main content
Rasmus Agergaard > Stefan Nychka • 5 months ago
Thank you. I was having the same problem, and this fixed it :)
1△ ▽ • Reply • Share ›

Mike Bradley • 6 months ago


Hi there, I really wanted to congratulate you on the marvellous content you've produced in this
course. I really love the accessible way in which you've presented this material. You've really
sterling job.
Kind regards,
Mike [UK]
1△ ▽ • Reply • Share ›
Pluralsight uses cookies. Learn more about your privacy

Deborah Kurata > Mike Bradley • 6 months ago


https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 3/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
y g

Great to hear! Thanks!


△ ▽ Search…
SM
• Reply • Share ›

a.king • 8 months ago


This is a great class, Deborah - I've a much better grasp on the basics of C# thanks to your co
Your approach and examples to highlight what is being taught are spot on. Thanks for providi
quality class, again.
1△ ▽ • Reply • Share ›

Deborah Kurata > a.king • 7 months ago


Thank you so much for the kind words! I appreciate it!
△ ▽ • Reply • Share ›

Rick Adams • 8 months ago • edited


Ah I give up. This course simply cannot be used with Visual Studio Mac. Will try something el
Could not get the UNIT test to run either.
△ ▽ • Reply • Share ›

Rick Adams > Rick Adams • 8 months ago


I followed your Angular courses which are also excellent. ASP.NET core and Angular w
very well together. So I do all my development work on an Apple Mac. So I do believe
running on Macs are an important target. Thanks.
△ ▽ • Reply • Share ›

Deborah Kurata > Rick Adams • 8 months ago


Thank you for the kind words!

I am currently considering updating my C# courses when VS 2019/.NET Core 3


out next year. At that time, I'll be sure to keep Visual Studio for the Mac compat
mind.

Thank you again for all of the additional information!


△ ▽ • Reply • Share ›

Deborah Kurata > Rick Adams • 8 months ago


Between the fact that my project
Skip doesn't
to main use .NET Core (it was done with VS 2015) an
content
WPF project, it is not going to work "as is" on a mac.

As you said, you can build your own project using one of the provided templates. You
build the class library bits of the collections, but you'd have to use the class library from
different UI (a console app or even a unit test).

So it may be quite a bit of work to translate the hands-on for a mac.

I'll put it on my todo list!

Thank you so much for providing all of this additional information!


△ ▽ • Reply • Share ›
Pluralsight uses cookies. Learn more about your privacy
Deborah Kurata > Rick Adams • 8 months ago • edited
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 4/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Have you tried any of the other C# content in the library? Does it run on Visual Studio
Search… SM
For now, if you are interested in the concepts you could watch the course without doin
hands-on activities.

In the mean time, I'm looking into the limitations of Visual Studio for the Mac. (I though
they only created/executed "cross platform apps" for iOS and Android using Xamarin?
update you when I know more.
△ ▽ • Reply • Share ›

Rick Adams > Deborah Kurata • 8 months ago


Well Visual Studio for the Mac supports .NET Core. So extensive use of C#. Pl
see the image.

△ ▽ • Reply • Share ›

Deborah Kurata > Rick Adams • 8 months ago


Thanks! Without a mac it was hard to confirm.
△ ▽ • Reply • Share ›

Rick Adams • 8 months ago


After loading your starter solution from GitHub I see errors in Visual Studio. "The project type
supported on Visual Studio 2017 for Mac."
△ ▽ • Reply • Share › Skip to main content

Deborah Kurata > Rick Adams • 8 months ago • edited


This course was authored in Visual Studio 2015, which was prior to a Mac version.

You should be able to start a new project on the mac and then copy over all of the *ap
from my github.

Let me know if that works for you.


△ ▽ • Reply • Share ›

Rick Adams > Deborah Kurata • 8 months ago


Pluralsight uses cookies.Well
Learn more about
Acme.Wpf your not
would privacy
work on a MAC and that makes sense as I understa
was designed for Windows. I don't know the implication of not being able to run
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 5/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
g g
I have not got very far on this course.
Search…
△ ▽ • Reply • Share › SM

S.Dickie • 8 months ago


Just a heads up, The code files in the "Exercise files" section of this Pluralsight course doesn
on VS 2017. I kept getting debug/obj errors. The one on Github mentioned by Deborah in the
module works fine and builds perfectly.
△ ▽ • Reply • Share ›

Deborah Kurata > S.Dickie • 8 months ago


Thanks for posting!
△ ▽ • Reply • Share ›

Faisal • 8 months ago


This is a very well organized and very well explained course. Instructor has explained really w
have been working on the collections and generics but after listeing to this course, my knowle
really expanded and now I know the difference of different collection.
Thank you Sister for explaining in such a well organized way. Thank you very much!!
1△ ▽ • Reply • Share ›

Deborah Kurata > Faisal • 8 months ago


That is very kind of you to say. Thank you so much!
△ ▽ • Reply • Share ›

Daniele Tortora • 8 months ago


I find the use of a previous built code an incredible missing opportunity for this course. Debora
explains concept very clearly and the slides are well put together.
However, building class from scratch would have given the opportunity to better understand th
and behaviours of the concept explained. Instead, not having completed her previous C# cou
find this learning experience very passive and abstract.
I have cloned both the repository from GitHub and the 'Exercise' section here, although I cont
have different errors when attempting to run the tests.
Overall, I will definitely use some of the section to refresh the concept, but with a better Demo
approach, this would have been a much better course.
△ ▽ • Reply • Share ›
Skip to main content
Deborah Kurata > Daniele Tortora • 8 months ago
Thank you so much for your feedback.

Yes, it is a trade off. There is quite a bit of code required to get the framework in place
covering the topics in this course.

On the plus side, starting every course from scratch solidifies *all* of the basic coding
techniques.

On the down side, it makes the course significantly longer and could be quite repetitive
viewer is taking all of the courses in a "learning path".
Pluralsight uses cookies. Learn more about your privacy
Regarding your error, it is using the deliverBy date and comparing it to the current date
deliverBy date is before the current date it will throw this error. So recheck the deliverB
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 6/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
deliverBy date is before the current date it will throw this error. So recheck the deliverB
you are using and ensure it is today or in the future. (If you use the date shown in this
Search…
it will be too far back in the future and will generate this error.) SM

△ ▽ • Reply • Share ›

Daniele Tortora > Daniele Tortora • 8 months ago

△ ▽ • Reply • Share ›

Alexander • a year ago


Should be swapped with C# collections fundamentals. As there are only 2 modules, that are a
Simon's course, and all others are covered with much more depths than here.

And nothing personal, but you remind me of Professor Cuthbert Binns ;)


△ ▽ • Reply • Share ›
Skip to main content

Deborah Kurata > Alexander • a year ago


Thank you for your post. :-(
△ ▽ • Reply • Share ›

kirishna • a year ago


can you give me example why do we reuire Ienumerable or ienumerator when we have for or
loop and when to use these interfaces any code example you have please to explain this?
△ ▽ • Reply • Share ›

Amos Johnson > kirishna • a year ago


These interfaces
Pluralsight uses cookies. also
Learn more allow
about you
your the flexibility
privacy to program to an abstraction. This is espe
beneficial if you are writing a WCF service, as it requires a contract. If you create a me
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 7/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

that returns IEnumerable your leaving it up to the caller to decide what type of collectio
use. InSearch…
the future if you decide to use a different collection within your method you
SMwill
have to go back and change every single instance where that method is called, so lon
collection already implements that interface. If you don't care about the ordering and ju
to iterate over your data use IEnumerable, if you care about adding/removing data use
ICollection, and if you care about the ordering and accessing an item by the index use
1△ ▽ • Reply • Share ›

Deborah Kurata > kirishna • a year ago


You only need the interfaces if you are building your own type that you want to use as
collection. If you are using an existing collection type then you don't need to define the
interfaces yourself as they already implement them.

You can read more about it here: https://msdn.microsoft.com/...

In the example shown at the above link, they use the interface to iterate over a set of P
objects defined in an array. The easier way to implement this code would be to use on
collection classes (like the generic List<person>) which already implements the interfa

So in the vast majority of applications, you won't need to use the IEnumerable interfac
would instead use List<t> or similar.

Hope this helps.


△ ▽ • Reply • Share ›

Ramona W. • a year ago


I figured out the issue. The path was too long for those files from the location in the file system
moved it to a different folder and it is all good now!
1△ ▽ • Reply • Share ›

Deborah Kurata > Ramona W. • a year ago


Glad to hear you were able to resolve this! Thanks for letting me know!
△ ▽ • Reply • Share ›

Ramona W. • a year ago


When I try to build the starter project, I get Severity Code Description Project File Line Suppre
State Skip to main content
Error CS0006 Metadata file 'C:\Users\URAWARD\Documents\Training\CsharpBestPractices\c
best-practices-collections-generics\starterproject\CSharpBP-Collections-master\CSharpBP-
Collections-master\AcmeApp\Acme.Common\bin\Debug\Acme.Common.dll' could not be foun
Acme.Biz C:\Users\URAWARD\Documents\Training\CsharpBestPractices\csharp-best-practic
collections-generics\starterproject\CSharpBP-Collections-master\CSharpBP-Collections-
master\AcmeApp\Acme.Biz\CSC 1 Active

Any ideas?
△ ▽ • Reply • Share ›

Sunil Rathod • a year ago


Another
Pluralsight Great Course
uses cookies. fromabout
Learn more Deborah!! Thanks
your privacy a lot for it! I loved the Idea of including the FAQ
end of each concept. The simplicity of presenting complex concepts with ease is something w
l i !! K th i
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion h ! 8/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
always amazes me in your coursers!! Keep authoring such awesome courses!
2△ ▽ • Reply • Share ›
Search… SM

Deborah Kurata > Sunil Rathod • a year ago


Thank you so much for the kind words.
△ ▽ • Reply • Share ›

naskochina • 2 years ago


Hey Deborah,

I've noticed you don't use CultureInfo.InvariantCulture flag in Vendor.cs, line 50. So one of the
tests PlaceOrder_3Parameters fails when using different culture.

Cheers,
Petar Marinov
△ ▽ • Reply • Share ›

Deborah Kurata > naskochina • a year ago


Thanks for posting!
△ ▽ • Reply • Share ›

Egor Kostan • 2 years ago • edited


Hi all.
I have a problem with one unit test, it gives me following error:
Result Message: Assert.AreEqual failed. Expected:<>. Actual:<below recommended="" mark
percentage="">.
I am referring to "Building Generic Code with Generics" > "Using a Generic Class" video tutor
Can some one help me please?
Thanks
△ ▽ • Reply • Share ›

Deborah Kurata > Egor Kostan • 2 years ago


You can download the code "as of" the end of each module using the Exercise files tab
Just download the files, locate the folder for the module you are on, and unzip it. Then
can use a compare utility to determine where your code may be different than mine.

Let me know if that helps.


Skip to main content
△ ▽ • Reply • Share ›

Egor Kostan > Deborah Kurata • 2 years ago


Hi Deborah. I found the problem, it was inside Product class, instead of " else
if(markupPercent < 10)" I typed "else if(markupPercent <= 10)"... Thanks.
"
"
1△ ▽ • Reply • Share ›

Daumantas Drukteinis • 2 years ago


Deborah give us hope! Thank you for your courses, they're amazing
Pluralsight uses cookies. Learn more about your privacy
2△ ▽ • Reply • Share ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 9/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Deborah Kurata > Daumantas Drukteinis • 2 years ago


Search… SM
Thank you!
△ ▽ • Reply • Share ›

Ramaronera • 2 years ago


Hello Deborah,

Great course..!!!
1△ ▽ • Reply • Share ›

Deborah Kurata > Ramaronera • 2 years ago


Thanks!
△ ▽ • Reply • Share ›

Pieter • 2 years ago


Is this really an Intermediate course? It felt more like a course for beginners.
△ ▽ • Reply • Share ›

Deborah Kurata > Pieter • 2 years ago


If you look at the classification to the right under course info -> It is marked as a begin
course.

Is there something else that labelled it as an intermediate course?


△ ▽ • Reply • Share ›

Pieter > Deborah Kurata • 2 years ago


The C# Path's marked this as an intermediate course. That's why i made this
comment. Sorry if i came off a bit offensive.
△ ▽ • Reply • Share ›

Deborah Kurata > Pieter • 2 years ago • edited


Ah! They didn't involve us in that process. For learning path issues, plea
contact support at: support@pluralsight.com.

Despite the incorrect classification, I hope you enjoyed the course!


△ ▽ • Skip
Reply to
• Share
main ›content

Joseph Wulf > Deborah Kurata • 2 years ago


I think it's well placed for the intermediate. Especially in comparison with
in the beginner section of the C# path. This course really dove further in
hows/whys/concepts. It gave me the springboard I needed to get out of
off of basic tutorials!

Thanks!
3△ ▽ • Reply • Share ›

Deborah Kurata > Joseph Wulf • 2 years ago


Pluralsight uses cookies. Learn more about
So great toyour privacy
hear. Thanks!
△ ▽ • Reply • Share ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 10/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
py

Marco Julian • 2Search…


years ago SM

Saludos Deborah Kurata, muy agradecido y contento por seguir tu curso. un poco triste pues
termine.
Gracias desde México.
2△ ▽ • Reply • Share ›

Deborah Kurata > Marco Julian • 2 years ago


Muy amable de tu parte. Gracias. :-)
2△ ▽ • Reply • Share ›

IamWill • 2 years ago


Another great course. I loved the focus on best practices. Again the unit test approach demon
how unit testing is not time-consuming, it is prodigiously time-saving. However, I did miss the
structure you created in "C# Best Practices: Improving on the Basics."
2△ ▽ • Reply • Share ›

Deborah Kurata > IamWill • 2 years ago


Thank you for the kind words about the course.

Can you elaborate on the "structure" you are referring to? Are you referring to the stru
the unit tests? Or of the course? Or something else?
△ ▽ • Reply • Share ›

Valerii • 2 years ago


Deborah, hi, thanks for the course. Could you help, can`t get the following. Why I can`t get ret
value of method as List <t>?
public List<t>MyMethod <t>()
{
var value = new List <t>(); // if I change to T to string I get an error with return value, in this ca
can`t add value "hello" as it can`t covert T to string
value.Add("hello");
return value;
}
Thank you in advance,
△ ▽ • Reply • Share › Skip to main content

Deborah Kurata > Valerii • 2 years ago


There is a discussion of this here: https://stackoverflow.com/q...

Let me know if that helps.


△ ▽ • Reply • Share ›

Valerii > Deborah Kurata • 2 years ago • edited


Thank you, it helped. But faced with another issue. I was thinking about creatin
method which can handle any datatype. But faced with an issue with casting T
real type. I already checked many sources, like implementation of IConvertable
Pluralsight uses cookies.casting
Learn more aboutthen
to object yourto
privacy
real type. But still is not working as I want. So what I fe
to get: Generic metod which takes unkown data type T from the stream (in my
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 11/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
g y ( y
Network Stream) and return this data. It could be class, int, string, array etc. I c
Search…
with the following: SM

- I have a class which holds T type of data and its Type as properties. Idea is to
instance of this class serialize it and then desirialize on other side. And get data
real type (not T) and do some action with it. Class is the following:
**************
[Serializable]
public class Data<t>
{
public Type DataType { get; private set; }
public T GenericData { get; private set; }

public Data(T data)


{
this.GenericData = data;
DataType = data.GetType();
}
**************
So my method to get data as folllows:
**************
public static Data<t> GetData <t> (NetworkStream stream)
{
T data;
Data<t> dataToGet = null;

try
{
data = (T)binaryFormatter.Deserialize(stream); // it is rough and not ideal, just t
main idea
dataToGet = new Data<t>(data);
}
catch (Exception ex)
{
OnMessageHandler($"Помилка під час отримання даних:\n{ex}");
}

return dataToGet; // here I want to do something as follows: return (data.DataTy


dataToGet Skip to main content
}
**************
As result I can get data, but I can`t cast to its real type. Only if I know what I am
receiving i can cast as below:
Data<peer> data = DataTransfer.GetData<peer>(networkStream);

I feel like this is done automatically. My question, how can I get(return) data of
type (not T) (in my case I stored it as paremetr in the class). I was trying to do a
above: "return (data.DataType) dataToGet" - in this case it tells me that I am us
variable as a type.

Pluralsight uses cookies.Thank you inabout


Learn more advance,
your privacy
△ ▽ • Reply • Share ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 12/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search…
Deborah Kurata > Valerii • 2 years ago • edited SM
I am tied up at conferences over the next few weeks. And, technically, th
discussion is for answering questions specifically about this course.

You may find a quicker answer posting on www.stackoverflow.com.


△ ▽ • Reply • Share ›

KC • 2 years ago • edited


In interface as Parameter best practice slide , the best practice is not to use any of the interfa
the system.collections namespace as parameter . However in the previous slide , you passed
ICollection<vendor> as parameter in the method rather than using List<vendor>. I am not clea
is the best practice .
List of interfaces in System.Collections namespace
https://msdn.microsoft.com/...
△ ▽ • Reply • Share ›

Deborah Kurata > KC • 2 years ago


The recommendation is to use the System.Collections.Generic namespace interfaces
https://msdn.microsoft.com/...

So it is the difference between ICollection and ICollection<vendor> or IList vs IList<ven

Basically, don't use the "plain" interfaces ... use the "generic" interfaces (that is to say
interfaces with generic parameters.)

Make sense?
△ ▽ • Reply • Share ›

KC > Deborah Kurata • 2 years ago


Yes it does . Thanks
1△ ▽ • Reply • Share ›

Spencer ONeill • 2 years ago • edited


Hello,

I am attempting to follow with the 'Building a LINQ Query: Query Syntax" lesson, but I am rece
Skip to main content
an AssertFailedException when running the unit test. When looking in the Locals section of th
debugger, it shows that both the expected and the vendorQuery contain the same items in the
order. Is there any idea what might be going wrong?

I didn't include the code to help with readability, but I can add it if it helps (which i'm sure will b
case)

Edit: After actually double checking the output, I realized that I had accidentally put the comm
CompanyName field that was giving me an error. The debugging was actually helpful once I le
me what it was trying.
1△ ▽ • Reply • Share ›

Pluralsight uses cookies.


Deborah Learn
Kuratamore aboutONeill
> Spencer your privacy
• 2 years ago
Glad you resolved it!
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 13/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
y
△ ▽ • Reply • Share ›
Search… SM

Aaron Quaday • 2 years ago


"these are all the extension methods...Let's go through each one!"
HAH! you got me...I was seriously, like, ok, i guess there's not that many.

You've got a very direct, thorough and easy-to-follow (at least with capacity to rewind bits sev
times) style, so much so that the comments I've read here do not extend knowledge of the ma
which is always my favorite part of discussion boards.
I did try to think of some questions that arose as I went through the tutorial, but honestly, thos
occurred were usually addressed by your teaching, or beyond the breadth of the course.
The only thing that truly has me baffled is 'yield return.' Any advice for some additional hands-
on/tutorial style exercise for that?

Great work, looking forward to continuing to learn through your C# tutorials. Thank you!
△ ▽ • Reply • Share ›

Deborah Kurata > Aaron Quaday • 2 years ago


Thank you so much!

Regarding your question ... the docs have some info here: https://docs.microsoft.com/
there is some discussion here that may be of interest: https://stackoverflow.com/q...
△ ▽ • Reply • Share ›

Aaron Quaday > Deborah Kurata • 2 years ago


Thanks for the recommendations, I think I understand the situations where yield
would be useful, and the stackOverflow discussion had several in additional to
obvious, so that was appreciated. Implementing it, on the other hand, is a whol
ball of wax, which i look forward to trying out eventually. I've been doing challen
HackerRank, so I was hoping there may be a challenge in the future that would
solvable using yield return, so I could do some hands on work.

Actually, when one is tasked to work with an infinite set, is there another approa
(other than yield return, or artificially limiting either the bounds or size of the
collection)? I assume (in infinite sets) even with yield return, you would have to
some constraint/conditional to reach a yield break;
△ ▽ • Reply • Skip
Share ›
to main content

Deborah Kurata > Aaron Quaday • 2 years ago • edited


One of the classic examples of using yield return is with the Fibonacci o
series that don't actually end. And the yield return will yield after each e
so no need for gating or limiting bounds.

The other option, though I have not tried it, would be to consider using
Observables, which are part of the Reactive Extensions. Those are use
extensively in Angular/TypeScript to handle sets of incoming data. I've u
them often, but not with C#. So I'm not sure how well it would do. Some
else to look into? https://msdn.microsoft.com/... and
https://stackoverflow.com/q...
Pluralsight uses cookies. Learn more about your privacy
△ ▽ • Reply • Share ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 14/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Aaron Quaday > Deborah Kurata • 2 years ago • edited


Search… SM
Cool, will look into observables.
With a Fibonacci sequence, the foreach would just keep going forever, w
it, unless it threw an exception, or one gated it?
△ ▽ • Reply • Share ›

Deborah Kurata > Aaron Quaday • 2 years ago


Most implementations that I have seen pass in a max number or max va
Here is one example: https://stackoverflow.com/q... But otherwise, yes.
△ ▽ • Reply • Share ›

Ichimendo • 2 years ago


Well, I had to do this one as well. Once again, I enjoyd your course, the teaching technique.
I want to learn Italian, but bitten by the C# bug(!) there's no lingo time left...as for now, over an
thanks.
1△ ▽ • Reply • Share ›

Deborah Kurata > Ichimendo • 2 years ago


Thank you so much!
△ ▽ • Reply • Share ›

Andrew • 2 years ago


Hi Deborah,
Thanks for your course. For me as a non native speaker, your english tone is excellent to follo
course.
Im quite pleased with the content and fill a big caveat for many .Net programmers.

Regarding the coding, im quite happy writing Tests instead of the typical console application.
programmers are used to start testing just as soon classes are ready.
8△ ▽ • Reply • Share ›

Deborah Kurata > Andrew • 2 years ago


Thank you for the kind words! I appreciate the feedback!
△ ▽ • Reply • Share ›
Skip to main content
Yongxin Liu • 2 years ago
Hello Deborah, this course is amazing! Thanks for the hard work and the great content! I am
wondering if you would share the slides used in this course with us. Thanks!
1△ ▽ • Reply • Share ›

Deborah Kurata > Yongxin Liu • 2 years ago


Thank you *so* much for the kind words.

Yes! You can get the slides from the Exercise files tab above. They are included as pa
zip file you can download from there. Let me know if you can't find them.
△ ▽ • Reply • Share ›
Pluralsight uses cookies. Learn more about your privacy
Yongxin Liu > Deborah Kurata • 2 years ago
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 15/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Thank you! Found it


Search…
1 △ ▽ • Reply • Share › SM

Carson Powers • 2 years ago


EXTREMELY regimented and internally standardized lesson. You can really tell a programme
it. I learned a whole lot from this and sincerely appreciate the efforts Mrs. Kurata.
1△ ▽ • Reply • Share ›

Deborah Kurata > Carson Powers • 2 years ago


Thank you so much!
△ ▽ • Reply • Share ›

Ronnie Poulsen • 2 years ago


Hi Deborah,

Thanks once again for a really great course. You are perfectly good at explaining both theory
practice aspects of programming. I have a small question regarding this course, in Module 4 -
Building Generic Code with Generics > Section 3 - Building a Generic Class:

In the OperationResult class - is there a point in invoking the default constructor from the
parameterized constructor with :this(), if the default constructor doesn't contain any code? Or
just best practice?

Thanks in advance.
1△ ▽ • Reply • Share ›

Deborah Kurata > Ronnie Poulsen • 2 years ago


Thanks!

Regarding your question ... some consider calling the default constructor to be best pr
So much of code is maintenance ... so if anything is ever added to the default construc
will be called by all constructors.
△ ▽ • Reply • Share ›

Johnny Sandaire • 2 years ago • edited


Hello Deborah,
Skip to main content
Nice Course...
1△ ▽ • Reply • Share ›

Deborah Kurata > Johnny Sandaire • 2 years ago


Thanks!
△ ▽ • Reply • Share ›

Gavriel Zarka • 2 years ago


Hello.
i need to built a class that describe a queue like FIFO.
were i can find a good information how to do it?
Pluralsight uses cookies.
Reply Learn more about your privacy
△ ▽ • Share ›

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 16/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Deborah Kurata > Gavriel Zarka • 2 years ago


The C#Search…
SM
queue class provides this functionality. You can find out more about it here:
https://msdn.microsoft.com/...
△ ▽ • Reply • Share ›

Gavriel Zarka > Deborah Kurata • 2 years ago


Deborah thank you very much!!
△ ▽ • Reply • Share ›

Sean O'Brien • 2 years ago


This course was extremely difficult to follow. Not for what was taught but for the complete lack
or any sort of personality in the voice overs. I'm not sure wither or not you were talking throug
using a text to voice application. It was extremely difficult to stay focused or even engaged in
you were trying to teach.

Also, this course would have been more improved had it been a code along where everything
together. Allowing for a more hands on approach to what your teaching and for more real wor
applications.
△ ▽ • Reply • Share ›

Deborah Kurata > Sean O'Brien • 2 years ago


Thank you for your feedback.

Some viewers have listened at 1.2 or 1.5 times speed. You could try that.

And the course is set up to be "code along". In the introduction module I talk through h
get some starter files that you can add to and code along with the course. Could you e
on why you thought otherwise?
△ ▽ • Reply • Share ›

Sean O'Brien > Deborah Kurata • 2 years ago


The speed isn't the issue, it's the lack of tonality. It sounds like you have no pas
interest in delivering your content. Imagine listening to a song with only a single
pitch. You would find it extremely difficult to keep listening, even if it was by an
you were particular fond of. Even just having some infliction, or some variance
your saying would have made it easier for me to listen more closely.
Skip to main content
Yes, you do have some coding, but it seemed to focus more on creating test ca
than anything else. Taking the time to write a simple console program together
like what the guy who done the C# intro course does, Scott Allan I think), I feel,
have been more beneficial. As not only do I get to have a working program to s
at the end for any sort of interview that may want a code sample. I also get the
to expand upon it as well. Using what I've learnt from yourself to better improve
program.

Really, I'm just wanting to be a lot more engaged in the content. This is a dry su
matter, so doing anything to make learning it more fun and engaging is almost

Those are just my thoughts on it. It's a popular course, but I have to be honest
Pluralsight uses cookies. Learn more about your privacy
it was a struggle to keep myself focused. Which is a shame as I like generics a
to know more about them
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 17/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
to know more about them.
△ ▽
Search…
• Reply • Share ›
SM

Deborah Kurata > Sean O'Brien • 2 years ago


Thank you for your candid comments. I had wanted to be a teacher sinc
a child and was very happy to have the opportunity to teach this materia
sad that my mid-Western tone masked this for you.

As one who has hired and helped clients hire many, many .NET develop
can tell you that they would *much* prefer someone that has a handle o
writing good unit tests over someone that can put together a simple con
application. Plus I provided *BOTH* a Windows Forms AND a WPF fron
with the sample app to make it such that the app could be expanded up
using whichever front end technology you preferred.

If you want to learn more about Generics, try Scott's course:


https://app.pluralsight.com....
△ ▽ • Reply • Share ›

Sean O'Brien > Deborah Kurata • 2 years ago


Hi there

I've been doing your other courses as part of the C# course and I took y
advice of speeding up the video a fraction. This is has given me the des
result I was after. I am learning a great deal, thank you very much for ta
time to do these courses.
3△ ▽ • Reply • Share ›

Deborah Kurata • 2 years ago


NOTE: This C# collections discussion board was down for several weeks due to an issue with
vendor (livefyre) removing access. The board is now back up with a new vendor (Disqus). So
feel free to post any question/issues/comments here.
Thanks!
△ ▽ • Reply • Share ›

rwobben • 2 years ago


I followed it now till using the generic class.
Skip to main content
I did as far as I know everything as you described and still one test is failing namely
PlaceOrder_3Parameters.

In the video it's green and on my computer red.

I can see this error message :

Message: Assert.AreEqual failed. Expected:<Order from Acme, Inc


Product:
Pluralsight Saw Learn more about your privacy
uses cookies.
Quantity: 12
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 18/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Deliver By: 10/25/2018


Search…
Instructions: standard delivery>. Actual:<Order from Acme, Inc SM
Product: Saw
Quantity: 12
Deliver By: 25-10-2018
Instructions: standard delivery>.

and on output I see this :

Standard output :

Action : Message sent : New Order.

Any idea where Im going the wrong way ?

△ ▽ • Reply • Share ›

DeborahK89 > rwobben • 2 years ago


rwobben If you look at the "Deliver By" date you'll see the problem.

I had fixed this in my GitHub files (NOT in the files provided here by Pluralsight.) Here
link: https://github.com/DeborahK/CSharpBP-Collections

For more information, see the discussion below dated around Feb 23, 2016.

Let me know if you are able to find my GitHub repo with the fix for this.
△ ▽ • Reply • Share ›
Skip to main content
rwobben > DeborahK89 • 2 years ago
DeborahK89 rwobben Thanks.

I downloaded already from the pluralsight download link.

When I click on that I get redirected to that.

I found the discussion on Feb.23 2016 ,changed it and everything works fine.
Pluralsight uses cookies. Learn more about your privacy

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 19/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

△ ▽ • Reply • Share ›
Search… SM

rwobben • 2 years ago


I downloaded the files from your github page like you said on the videos.

But on the arrays part , you said to change the product.cs file but there is no product.cs file in
github repo
△ ▽ • Reply • Share ›

DeborahK89 > rwobben • 2 years ago


rwobben I'm not sure which github repo you are looking at, but I see that file
here: https://github.com/DeborahK/CSharpBP-Collections/tree/master/AcmeApp/Acme

Let me know if you don't see it.


△ ▽ • Reply • Share ›

rwobben > DeborahK89 • 2 years ago


DeborahK89 rwobben

I see it. Thanks


△ ▽ • Reply • Share ›

fjpgir • 3 years ago


Hi, How will be the RetrieveArray method in the VendorRepository?

Error CS1061 'VendorRepository' no contiene una definición para 'RetrieveArray' ni se enc


ning&#250n método de extensión 'RetrieveArray' que acepte un primer argumento del tipo
'VendorRepository' (&#191falta alguna directiva using o una referencia de ensamblado?)
Acme.BizTests D:\Pluralsight\2. Intermedio\Best Practices\0.
Exercises\AcmeApp\Tests\Acme.BizTests\VendorTests.cs
Skip to main content
△ ▽ • Reply • Share ›

PrakashBorekar • 3 years ago


Thank you so much Deborha. I am your great fan and have done most of your courses here a
Pluralsight. I liked the way you intelligently put the concept across and explain from the leane
of view. Thanks a ton. Looking forward to many more. Prakash
△ ▽ • Reply • Share ›

DeborahK89 > PrakashBorekar • 3 years ago


PrakashBorekar Thank you so much!
△ ▽ • Reply • Share ›
Pluralsight uses cookies. Learn more about your privacy

RobertIngleby • 3 years ago


https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 20/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
RobertIngleby • 3 years ago
Great course Deborah - very well put together. Somebody else asked about the lack of aSM cour
Search…
completion certificate, which other courses on the C# path still do have. Do you know what is
current PS policy on this - I can just contact PS support and get one as I can score high enou
the practice questions? Or something.
△ ▽ • Reply • Share ›

DeborahK89 > RobertIngleby • 3 years ago


RobertIngleby Thank you!

No, I don't know. Contact support at support@Pluralsight.com and they should be able
answer your questions about this. And maybe you could share their reply here? Thank
△ ▽ • Reply • Share ›

RobertIngleby > DeborahK89 • 3 years ago


DeborahK89 RobertIngleby
The answer is apparently for any course that does not have a certification you
PS support to supply a certificate of completion as a PDF file. It doesn't actually
you've understood one word of the course, but as I can answer all your test que
correctly I feel entitled to it.
△ ▽ • Reply • Share ›

DeborahK89 > RobertIngleby • 3 years ago


RobertIngleby DeborahK89 Thanks for posting their reply. Glad you wer
to get one!
△ ▽ • Reply • Share ›

sortednoun • 3 years ago


It's v helping course but the only thing I could not understand is Defining an iterator with yield
△ ▽ • Reply • Share ›

DeborahK89 > sortednoun • 3 years ago


turkush A method that returns a set of items returns the set all at once. If you use an it
with a yield, you get one item at a time, instead of all of them at once. Does that help?
△ ▽ • Reply • Share ›
Skip to main content
hiloczki • 3 years ago
Thanks for your courses. They can be understood with intermediate English knowledge.

One part when I am confused about is when testing ICollection interface. (Gen.Coll.Interfaces
Returning IEnumerableT at 1:40).

How does that vendorMaster -List<Vendor> know about my adding of a vendor at the test.cs?

This is the adding in the VendorRepositoryTest.cs: vendorCollection.Add(new Vendor(){so


vendor};
△ ▽ • Reply • Share ›

DeborahK89
Pluralsight uses cookies. >more
Learn hiloczki • 3 years
about yourago
privacy
hiloczki I'm not sure I understand the question? You should not need to test the built in
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 21/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

ICollection methods?
△ ▽ Search…
• Reply • Share › SM

ophidiancartomancy • 3 years ago


Was some kind of narration software used for this course? It comes across as unnatural... pa
after hearing Deborah's 'real' voice on a web interview.

Just wondering if anyone else was hearing it that way...

Course content is great and very well-explained, though!


△ ▽ • Reply • Share ›

DeborahK89 > ophidiancartomancy • 3 years ago


ophidiancartomancy I work hard to keep the narration professional and consistent. Bum
that it comes off as unnatural to you.

Thank you for the kind words about the course content.
△ ▽ • Reply • Share ›

dmarsa • 3 years ago


Hi Deborah, another great course. Thanks.
△ ▽ • Reply • Share ›

DeborahK89 > dmarsa • 3 years ago


dmarsa Thank you!
△ ▽ • Reply • Share ›

tsonev7 • 3 years ago


Hi Deborah, thanks for the course!

However, I have one concern regarding your statement "Return IEnumerable to avoid modific
the collection" Skip to main content

This is not entirely true, because the caller can simply cast the IEnumearble to ICollection and
change the collection.

If you want to use true readoly collections, you should use the ReadOnlyCollections included
△ ▽ • Reply • Share ›

DeborahK89 > tsonev7 • 3 years ago


tsonev7 Thank you for your post.

Pluralsight uses cookies. Learn more about your privacy


If you create a "True" IEnumerable like this example:

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 22/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

public IEnumerable<Vendor> RetrieveWithIterator()


Search… SM
{

// Get the data from the database

this.Retrieve();

foreach (var vendor in vendors)

Console.WriteLine($"Vendor Id: {vendor.VendorId}");

yield return vendor;

Then if you try to cast to ICollection you'll get an InvalidCastException.

If you create a List<Vendor>, pass it out as an IEnumerable<Vendor>, then cast it bac


ICollection or List<Vendor>, then you will be able to update it.

Try this and let me know if it makes sense.

Thanks!
△ ▽ • Reply • Share ›

miloshB > DeborahK89 • 3 years ago


DeborahK89 tsonev7
Skip to main content

Hello,

I also noticed what Mr tsonev7 said here and I saw a reply with a proposed
RetrieveWithIterator method.

Even if we are not able to cast to ICollection, that doesn't mean that we cannot
data.

We may not be able to add/remove Vendors to existing collection, but we can m


Pluralsight uses cookies.existing members
Learn more sinceprivacy
about your our collection is of reference type IEnumerable<Vendo

So if we iterate over our retrieved IEnumerable collection


https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 23/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
So, if we iterate over our retrieved IEnumerable collection

Search…
foreach (Vendor v in vendors) SM

v.Name = "whatever";

we can change its properties. At least that is what I understood in earlier stage
course where something like this is explained.

To protect it, one example is create a copy of it like

return vendors.Select(s => new Vendor{ Id = s.Id, Name = s.Name }).T

or something like that

Anyway, I think that it should be stated here more clearly that this is not a reaso
our Method should return IEnumerable, because listener can understand that it
security reasons...

Just wanted to share my opinion


△ ▽ • Reply • Share ›

DeborahK89 > miloshB • 3 years ago


miloshB DeborahK89 tsonev7 You are correct. You cannot change the
*collection* itself, but you *can* change the items in the collection as yo
stated.
△ ▽ • Reply • Share ›

liamsacc • 3 years ago


Question Marks for object properties when debugging the Lists

I was getting ? for each item when list , when discussing it with experienced colleagues, we f
Skip off
that there is a setting that is turned to main content
in VS2015:

FIX: Options in VS - turn on Managed Compatibility mode in the debugging option.


the new version of Debugger in VS 2015 doesnt load up the assemblies unless required

hope that helps!

△ ▽ • Reply • Share ›

DeborahK89 > liamsacc • 3 years ago


liamsacc Thanks for posting this!
Pluralsight uses △ ▽ •Learn more
cookies. • Reply Share ›
about your privacy

J i Di hid
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 24/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
JuniusDimasuhid • 3 years ago
Hi Deborah, Search… SM

Thank you for your time and effort for such another great video tutorial on best practices on
collections and generics. It is concise and helpful.

Just wondering if you can make a video tutorial on Best Practices on Asynchronous Programm
with async and await, that would be very awesome!

Cheers!
△ ▽ • Reply • Share ›

DeborahK89 > JuniusDimasuhid • 3 years ago


JuniusDimasuhid Have you seen this course on Async/Await?

https://app.pluralsight.com/library/courses/skeet-async/table-of-contents
△ ▽ • Reply • Share ›

liamsacc • 3 years ago


Hi Deborah,

Great course by the way!, just got a query that I thought I would pose to you before starting it
ensure Ive done it correctly!,

Im debugging my Collection from the initializer test, my Vendors list though doesn't contain th
strongly typed items when I debug it, it just has the items as ? in them..

any ideas!?

Skip to main content


△ ▽ • Reply • Share ›

AkhileshSahu • 3 years ago


Deborah , can you add a video about the test case ,a introductory one that tells what it is and
use .

thank you

△ ▽ • Reply • Share ›

DeborahK89 > AkhileshSahu • 3 years ago


Pluralsight uses cookies. Learn more about your privacy
AkhileshSahu I have an introduction to unit testing in my Defensive Coding
course: https://app pluralsight com/library/courses/defensive coding csharp/table of co
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 25/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
course: https://app.pluralsight.com/library/courses/defensive-coding-csharp/table-of-co

Search… SM

Let me know if that provides the information you were looking for.
△ ▽ • Reply • Share ›

xernai • 3 years ago


Deborah, congrats for your cool and interesting course!, it'd be nice a
continuation to see in action other kinds of collections like Sets or
LinkedLists and obviously your Best Practices.

Just one doubt to


finish: in the module "Generic List", section "Initializing a List of
Objects" -minute 6:37, when the class Vendor overrides Equals methods.

public override bool Equals(object obj)


{
if (obj == null || this.GetType() != obj.GetType())
return false;

Vendor compareVendor = obj as Vendor;


if (compareVendor != null &&
this.VendorId == compareVendor.VendorId &&
this.CompanyName == compareVendor.CompanyName &&
this.Email == compareVendor.Email)
return true;

return base.Equals(obj);
}

I
was wondering if it is necessary to call base.Equals(obj) in the final
statement when all the conditions fail or just return false.

Thanks in advance for this clarification.

Javier
Skip to main content
△ ▽ • Reply • Share ›

DeborahK89 > xernai • 3 years ago


xernai You could just return false ... depending on what you want your override to do.

Here is an article for further information on overriding equals: https://msdn.microsoft.co


us/library/ms173147(v=vs.90).aspx
△ ▽ • Reply • Share ›

Sviatoslav Filippov • 3 years ago


Pluralsight uses cookies. Learn more about your privacy
Hello, Deborah!
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 26/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search… SM
Can I find a complete list of FAQ from all your courses anywhere? They are really helpful.

Thx
△ ▽ • Reply • Share ›

DeborahK89 > Sviatoslav Filippov • 3 years ago


Sviatoslav Filippov I don't have them anywhere else ... but this is a great idea! Thanks
△ ▽ • Reply • Share ›

Ballinhuge • 3 years ago


Another great course. Thanks for your time and effort, it shows.
△ ▽ • Reply • Share ›

DeborahK89 > Ballinhuge • 3 years ago


Ballinhuge Thank you!
△ ▽ • Reply • Share ›

whiteswan • 3 years ago


This was the most interesting course I've done on Pluralsight. Dint felt bored, actually....the sl
were well formatted and the entire series was well planned and executed...thanks Deborrah!!
△ ▽ • Reply • Share ›

DeborahK89 > whiteswan • 3 years ago


whiteswan Thank you very much!
△ ▽ • Reply • Share ›

stevecrane • 3 years ago


I've just finished the section on arrays. You mention multidimensional arrays but don't demons
how to declare or reference them. Perhaps this is something you should add.
△ ▽ • Reply • Share ›

DeborahK89 > stevecrane • 3 years ago


Skip to main content
stevecrane Thanks for the suggestion. In almost all cases, there are better/easier way
using multidimensional arrays. Because this is not a commonly used feature and I am
on time, I opted not to include it in the course.

If you do really need to use multidimensional arrays, you can find info here:
https://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx

Thanks again!
△ ▽ • Reply • Share ›

stevecrane > DeborahK89 • 3 years ago


DeborahK89 stevecrane Thanks Deborah, as I said I rarely need to use them.
Pluralsight uses cookies. Learn more about your privacy
the old days I made extensive use of VB6 variant arrays but as you say, there a
usually better ways to do things in C#
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 27/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
usually better ways to do things in C#.
△ ▽ • Reply • Share ›
Search… SM

steelpaddy • 3 years ago


I am about halfway through this course and it is very impressive and well done. I skipped ahe
little to see where you would cover IQueryable and it seems to not be covered. As a key colle
that inherits IEnumerable (and used iin standard Entity Framework configurations) I am very c
why you don't cover IQueryable? I haven't finished the course yet so maybe you cover it or e
something about it at some point (if so, I apologize for jumping the gun with this question) but
disappointed that it does not seem to be covered as your explanations are very thorough and
key collection I am trying to understand better (and so I'm wondering the reasoning for not inc
it). Thanks!
△ ▽ • Reply • Share ›

DeborahK89 > steelpaddy • 3 years ago


steelpaddy Thank you for the kind words about the course!

I mention IQueryable in module 6/clip 6: "Returning


IEnumerable<T>" (at the very end of this clip).

I did not cover it in detail because there was not an easy way to demonstrate it withou
query provider (such as Entity Framework or LINQ to SQL). And I did not want to stray
the purpose of the course to cover Entity Framework or LINQ to SQL.

I'm sure Julie covers using IQueryable in one of her many great Entity Framework cou
△ ▽ • Reply • Share ›

TemplarSoft • 3 years ago


This course needs a certificate and so do your other ones as they are quite nice!

After going half way through your best practice courses I noticed that they did not offer a cour
completion certificate and this makes me know want to reduce the seriousness and level of at
was paying to your nice courses. Now, I feel it should be just like a in passing when free then
△ ▽ • Reply • Share ›

DeborahK89 > TemplarSoftSkip


• 3 years ago content
to main
TemplarSoft I am checking with Pluralsight on this. You may also want to check with
Pluralsight support regarding getting certificates of completion.
△ ▽ • Reply • Share ›

bahrami • 3 years ago


Hi Deborah,

Subtitles why not?

Pluralsight uses cookies. Learn more about your privacy

thanks
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 28/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

△ ▽ • Reply • Share ›
Search… SM

DeborahK89 > bahrami • 3 years ago


bahrami I really don't know how Pluralsight decides which courses get subtitles. You m
want to contact Pluralsight support here: http://support.pluralsight.com/

Let me know if you don't get an answer and I will try from my end.

Thanks for your interest!


△ ▽ • Reply • Share ›

Mr_Jay • 3 years ago


Hi Deborah,

Thank you for this great course. It has been very helpful for me. You have the ability to build y
lessons in a clear and logical order.

What plans do you have for further 'Improving on the basics' courses?

I'm hoping you'll do one on threading and user concurrency.

Cheers!

△ ▽ • Reply • Share ›

DeborahK89 > Mr_Jay • 3 years ago


Mr_Jay Thank you so much! I've been considering a third course ... but have not final
anything yet.

Thanks again!
Skip to main content
△ ▽ • Reply • Share ›

Spidermain50 • 3 years ago


This course was informative and easy to understand. I learned so much. Thank you for this co
△ ▽ • Reply • Share ›

DeborahK89 > Spidermain50 • 3 years ago


Spidermain50 Thank you so much!
△ ▽ • Reply • Share ›

Fernando Galvan • 3 years ago


Hi,uses
Pluralsight are cookies.
there any plans
Learn to add
more completion
about certificate
your privacy on this course? Thanks
△ ▽ • Reply • Share ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 29/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search…
DeborahK89 > Fernando Galvan • 3 years ago SM

Fernando Galvan From what I understand from Pluralsight ,... the new Learning Chec
yet have certificates. They suggested that you contact Pluralsight support and they ma
able to get one for you.
△ ▽ • Reply • Share ›

Fernando Galvan > DeborahK89 • 3 years ago


DeborahK89 Ok, I will ask them, thanks!
△ ▽ • Reply • Share ›

TemplarSoft > Fernando Galvan • 3 years ago


Fernando Galvan DeborahK89 did you get a certificate?

△ ▽ • Reply • Share ›

Fernando Galvan > TemplarSoft • 3 years ago


TemplarSoft yes, I just contacted support
△ ▽ • Reply • Share ›

DeborahK89 > Fernando Galvan • 3 years ago


Fernando Galvan I don't know. I'll check with Pluralsight to find out.
△ ▽ • Reply • Share ›

katycarpenter • 3 years ago


Great course, Deborah! :)
△ ▽ • Reply • Share ›

DeborahK89 > katycarpenter • 3 years ago


katycarpenter Thanks!
△ ▽ • Reply • Share ›

glenread • 3 years ago


Hi Deborah,
Skip to main content

The way that you explain things is wonderful! I was hoping that someday you could have MV
one of the courses so that this could be explained as well.

Thank you for a great course!

- Glen Read
△ uses
Pluralsight ▽ cookies.
• Reply •Learn
Share ›
more about your privacy

>
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 30/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
DeborahK89 > glenread • 3 years ago
glenread Thank you so much!
Search… SM
△ ▽ • Reply • Share ›

glenread • 3 years ago


Hi Deborah,

I'm wondering if this is another feature of VS2013. When I type in the code for the generic me
(using "T" for the "RetrieveValue" method), the color of the "T" does not change from black to
turquoise as it does on yours when inserting the "<T>". However, everything compiles cleanly
assume that it is working. Have you found the non-turquoise "T" to be a problem elsewhere?
you for your help.

- Glen Read
△ ▽ • Reply • Share ›

DeborahK89 > glenread • 3 years ago


glenread Have to say that I really don't pay much attention to the color coding. It could
theme that you are using vs the one I used. But if it compiles and no syntax error, I ass
you are fine!
△ ▽ • Reply • Share ›

fuzzy_monster • 3 years ago


Thank you so much for yet another great course. I was really struggling with generics, when a
to use interfaces as parameters to the functions and return values... But you did it again.

Very clear, piece by piece.

Good job, Deborah.

Sergey.
△ ▽ • Reply • Share ›
Skip to main content
DeborahK89 > fuzzy_monster • 3 years ago
fuzzy_monster Thank you so much!
△ ▽ • Reply • Share ›

gray433 • 3 years ago


No multidimensional lists? What do you mean?

var mdList = new List<List<int>>

{
Pluralsight uses cookies. Learn more about your privacy

Li t<i t> { 1 2 3 4 5 6 7 8 9 10 }
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 31/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },

newSearch…
SM
List<int> { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 },

new List<int> { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 },

new List<int> { 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 },

new List<int> { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 },

new List<int> { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 }

};

var num = mdList[1][5]; // 16


△ ▽ • Reply • Share ›

DeborahK89 > gray433 • 3 years ago


gray433 Guess that's a naming thing ... I'd call it a list of lists instead of a multidimensi
△ ▽ • Reply • Share ›

gray433 > DeborahK89 • 3 years ago


DeborahK89 I guess it would be more appropriate to call it a jagged list, since i
resembles a jagged array.
△ ▽ • Reply • Share ›

EugeneHuseynov • 3 years ago


The Learning check is glitching. On the 7th questions:

What is the key difference between a list and a dictionary?

The answer: A list is accessed by index, and a dictionary is accessed by key. - assumed
WRONG ANSWER
Skip to main content
After that the survey shows this 7th question over and over.

I played with that and find out that the "correct" answer is

some time: A list is accessed by key, and a dictionary is accessed by index

in other time: A list is fixed-length, and dictionary can be any length

Here as two screenshots.

Pluralsight uses cookies. Learn more about your privacy

R l Sh
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 32/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

△ ▽ • Reply • Share ›

Search… SM
DeborahK89 > EugeneHuseynov • 3 years ago
EugeneHuseynov They had told me they fixed this. Were you able to try it again recen
△ ▽ • Reply • Share ›

DeborahK89 > EugeneHuseynov • 3 years ago


EugeneHuseynov Yes, I'm getting this same thing! I reported it to Pluralsight yesterday
they are able to fix it soon!
△ ▽ • Reply • Share ›

AurelioA • 3 years ago


Deborah,

Thanks so much!

Excellent course. Congratulations!

Thanks!

△ ▽ • Reply • Share ›

DeborahK89 > AurelioA • 3 years ago


AurelioA Thanks!
△ ▽ • Reply • Share ›

glenread • 3 years ago


Deborah,

Skip tooption
What is the equivalent of the "Output" main content
in Studio 2013? When I look at the unit test
ProductName_JustRight, it only displays the elapsed time and a green check mark for the tes
passing. I can have a breakpoint in the Product class initiator, but it won't show the Output op
I choose the Output window (with the Ctrl-Alt-O option, or selecting it from the "View" menu, it
option to "show output from Debug", but it won't show the Console.WriteLine results (see "Re
an Element from an Array" 1:13 (of 2:18)). Instead, it shows a series of messages that read
'vstest.executionengine.x86.exe CLR v4.0.30319: UnitTestAdapter: Running ... " etc. The oth
options on the "Show output from:" output window are: Build, Build Order, SubVersion-Ankh-S
Tests. None of these appear to have the console output included. However, in the "Locals" w
can see the content.

Pluralsight uses cookies. Learn more about your privacy


Is there something that I can use in VS 2013 to get the displays to show up?
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 33/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search… SM

- Glen Read
△ ▽ • Reply • Share ›

DeborahK89 > glenread • 3 years ago


glenread VS 2013 *should* show the output. I'm at a conference on a laptop w/o VS 2
check this when I get back into the office.
△ ▽ • Reply • Share ›

glenread > DeborahK89 • 3 years ago


DeborahK89 glenread Hi Deborah, I goofed up. I wasn't watching closely enou
you were "running" the unit test instead of "debugging" the unit test, as I though
to be debugging the code. If I tried using the Run tests option, it does have an
window option.

I apologize for not having noticed this before.

- Glen
△ ▽ • Reply • Share ›

glenread • 3 years ago


Hi Deborah,

When I tried the first exercise (defining the array with color elements), I get an error that says
project with an Output Type of Class Library cannot be started directly. In order to debug this
add an executable project to this solution which references the library project. Set the execut
project as the startup project." This makes sense, but I'm not sure where to set up the startup
project; would it be in the Acme.Biz area? Would I just need to set up a project within this nam
to call the Product.cs area? Thank you for your help.

- Glen Skip to main content

P.S. - The tests worked fine; I am also using Visual Studio 2013, and have copied the code
specifically for this release from the Github site.
△ ▽ • Reply • Share ›

John J. Jingleheimerschmitt • 3 years ago


Hello, I created an IEnumerable<Employee> and found that there is an extension method of C
this type! Should I not use this method? You stated that I should use IEnumerable for iterating
and ICollection for iterating, adding, removing, and counting. Is this still true? Why shouldn't I
Count extension method on IEnumerable?

Pluralsight uses cookies. Learn more about your privacy

Thanks!
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 34/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

△ ▽ • Reply • Share ›
Search… SM

DeborahK89 > John J. Jingleheimerschmitt • 3 years ago


Ryan Woods If the underlying collection implements ICollection, then the Count exten
method uses the ICollection Count property to get the count of elements. Otherwise, th
method iterates over all of the items to get the Count. This gives you the count, but no
efficiently.
△ ▽ • Reply • Share ›

John J. Jingleheimerschmitt > DeborahK89 • 3 years ago


DeborahK89 Ryan Woods Ok, so if I have a dictionary<string, vendors> and I s
the values in an IEnumerable, then it will use the ICollection method for Count
a ValueCollection (type returned by dictionary<string, vendors>.value) impleme
ICollection?
△ ▽ • Reply • Share ›

DeborahK89 > John J. Jingleheimerschmitt • 3 years ago


Ryan Woods DeborahK89 That is my understanding, yes.
△ ▽ • Reply • Share ›

ssko99 • 3 years ago


Just my two cents. If they don't like your proposal, you can post it on udemy. Lots of people w
for quality courses.
△ ▽ • Reply • Share ›

DeborahK89 > ssko99 • 3 years ago


ssko99 :-)
△ ▽ • Reply • Share ›

ssko99 • 3 years ago


Greeting:

On your comment, "I am planning one more on "Building reusable code" to cover inheritance,
interfaces, abstract classes/methods, partial classes/methods, etc. Are there any other topics
you'd like to see? ", Can you please throw some thougts on events and delegates. Also, do y
have a plan to introduce a couseSkip
on to main content
angular2.0 with Typescript? I read the syntax will be diffe
and am not sure I should learn auglar 1.3. Thanks.
△ ▽ • Reply • Share ›

DeborahK89 > ssko99 • 3 years ago


ssko99 I do cover delegates in this course. But I will certainly consider adding more a
them in future courses.

Yes, I submitted a proposal for an Angular 2 course. I'll find out tomorrow if my propos
accepted. Wish me luck!
Pluralsight uses cookies. Learn more about your privacy

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 35/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

And if you want to see what's different now ... check out the Angular 2 documentation
Search…
https://angular.io/docs/ts/latest/ SM

Sometime later today or tomorrow they should be posting the "Angular 1 to 2 Quick
Reference" guide under "Cookbook". That will show the A1 vs A2 syntax changes.
△ ▽ • Reply • Share ›

paragjuneja • 3 years ago


As i learned and observed in the video that LINQ follows deferred execution. But when i am tr
same examples as provided by you on VS , i observe that my code does not follow the deferr
execution . Can you help and explain DeborahK89
△ ▽ • Reply • Share ›

DeborahK89 > paragjuneja • 3 years ago


paragjuneja DeborahK89 Which module/clip are you on? Can you explain what you a
seeing that leads you to this conclusion?

△ ▽ • Reply • Share ›

alkreddy • 3 years ago


Deborah, I learnt quite a bit from your other courses. Just started on this course. In my case,
starter application fails with one test case owing to Date Formats. The failing test is
PlaceOrder_3Parameters(). The actual.Message in my case (owing to my locale is ) Order f
Acme, Inc

Product: Saw

Quantity: 12

Deliver By: 25-10-2018

Instructions: standard delivery


△ ▽ • Reply • Share ›

DeborahK89 > alkreddy • 3 years ago


Skip to main content
alkreddy I updated the github files. Could you try again?
△ ▽ • Reply • Share ›

alkreddy > DeborahK89 • 3 years ago


DeborahK89 Well, I fixed it locally. FYI, I tested your change and that works we
△ ▽ • Reply • Share ›

DeborahK89 > alkreddy • 3 years ago


alkreddy DeborahK89 Excellent! Thanks!
△ ▽ • Reply • Share ›

Pluralsight uses cookies. Learn


DeborahK89 >more about
alkreddy yourago
• 3 years privacy

alkreddy Good catch! Thanks for letting me know!


https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 36/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
y g
△ ▽ • Reply • Share ›
Search… SM

swifty melb • 3 years ago


Another great course from Deborah. I thought at first the course seemed a bit slow and repet
I soon realised how well planed is that constant reinforcement of points, as this means that yo
actually really learn the material, unlike some courses where you quickly forget.
△ ▽ • Reply • Share ›

DeborahK89 > swifty melb • 3 years ago


swifty melb Yes, I considered throwing out the array portion ... because it was a little s
but I thought it provided some context for the rest.
△ ▽ • Reply • Share ›

sudhir9p • 3 years ago


Great course, the way you explain things is awesome , will be waiting to watch out much mor
courses from you!

I would like to have courses on using javascript IDEs like WebStorm ,atom shell etc... I was m
delighted to see a course on Visual Code but couldn't follow up the course as author uses ma
demonstration (All mac commands are used and the course doesn't seems to be for a novice

Hope you will , Thanks again.


△ ▽ • Reply • Share ›

DeborahK89 > sudhir9p • 3 years ago


sudhir9p Thank you so much for the kind words!

There is a good course on WebStorm here:


https://app.pluralsight.com/library/courses/webstorm-fundamentals

I use Visual Studio Code in my "Angular with TypeScript" course ... but that really won
you if you aren't doing Angular.

Thanks again for your message!


△ ▽ • Reply • Share ›
Skip to main content
afandre • 3 years ago
I downloaded the sample project from GitHub, opened it in VS2013, downgraded the app to .N
from 4.6 and when I build, I have 23 errors! Errors ranging from unexpected characters, synta
errors, assignments and metadata file problems.

The first error is "Unexpected character '$' in the Vendor class in the ToString method. I don't
this is something new in C#6 or just a typo. I removed it and the error went away. I don't know
will come around to bite me.

Pluralsight uses cookies. Learn more about your privacy

The second error is in the ProductTests Under the Product Null method the declaration "var
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 37/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
The second error is in the ProductTests. Under the Product_Null method, the declaration var
companyName = currentProduct?.ProductVendor?.CompanyName;" throws an error saying
ProductVendorSearch…
SM
doesn't exist in the current context. There is another error in this line with "Syn
error ':' expected.

There are 23 of these to go through just to get out of the Introduction!

The excitement I feel when I approach a new topic gets squelched when difficulties like this o
When I have to debug the project just to try to follow along with the course, especially since I
journeyman not an expert, is discouraging and stressful. When the instructor says "I run the te
they all work" I get angry and frustrated..

△ ▽ • Reply • Share ›

DeborahK89 > afandre • 3 years ago


afandre OK, I created a VS 2013 version of the sample code for you. You can find it h
https://github.com/DeborahK/CSharpBP-Collections
△ ▽ • Reply • Share ›

DeborahK89 > afandre • 3 years ago


afandre I added a comment to the github readme that states that the code is set up to
with Visual Studio 2015. Hopefully that will clarify it for anyone else trying to use it with
earlier version of Visual Studio. Also, if you find that you cannot use Visual Studio 201
some reason ... let me know and I'll see if I can get a version of the code up that works
Visual Studio 2013.
△ ▽ • Reply • Share ›

DeborahK89 > afandre • 3 years ago


afandre So sorry for your frustrations. The code is set up for VS 2015 as it does indee
some C# 6 features. The Introductory module of the course mentions that you can use
of the examples in VS 2013 (implying not all). So that is the why you are seeing a bun
syntax errors.
SkipVS
Is it possible to instead use to 2015?
main content
Such as the free VS 2015 Community edition?

Let me know if that is not possible and I'll look into posting a version of the code for VS
△ ▽ • Reply • Share ›

Course author

Deborah Kurata

Pluralsight uses cookies.


Deborah Kurata Learndeveloper,
is a software more about your privacy
consultant, conference speaker, and Pluralsight author. Her courses
include: "Angular: Getting Started", “Angular Routing”, and “Object-Oriented Programming...
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 38/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Search… SM
Course info

Level Beginner

Rating      (627)

My rating 

Duration 3h 35m

Released 27 Jan 2016

Share course

  

Skip to main content

Get support

Send feedback

Features

Pluralsight uses cookies. Learn more about your privacy


Authors

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 39/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight

Mobile & offline apps


Search… SM
Blog

Help center

How-to videos

Referral program

Terms of use

Privacy policy

Pluralsight uses cookies. Learn more about your privacy

https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 40/40

Potrebbero piacerti anche