C# Collections and Generics
C# Collections and Generics
C# Collections and Generics
Search… SM
Resume Course
LOG IN WITH
OR SIGN UP WITH DISQUS ?
Name
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?
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
You are right. Since I started with dictionaries I missed the override of Equals d
lists chapter.
Thank you!
1△ ▽ • Reply • Share ›
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 ›
I updated the repo with the current year + 1 instead of a hard-coded year to better pas
test into the future.
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 ›
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).
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 ›
△ ▽ • Reply • Share ›
You should be able to start a new project on the mac and then copy over all of the *ap
from my github.
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 ›
△ ▽ • Reply • Share ›
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 ›
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.
Any ideas?
△ ▽ • Reply • Share ›
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 ›
Great course..!!!
1△ ▽ • Reply • Share ›
Thanks!
3△ ▽ • Reply • Share ›
Saludos Deborah Kurata, muy agradecido y contento por seguir tu curso. un poco triste pues
termine.
Gracias desde México.
2△ ▽ • Reply • Share ›
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 ›
- 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; }
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}");
}
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.
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.
Basically, don't use the "plain" interfaces ... use the "generic" interfaces (that is to say
interfaces with generic parameters.)
Make sense?
△ ▽ • Reply • Share ›
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 ›
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 ›
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 ›
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
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
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 ›
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
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 ›
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 ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 16/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
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 ›
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 ›
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
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.
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 ›
Standard output :
△ ▽ • Reply • Share ›
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 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
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 ›
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 ›
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?
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
Thank you for the kind words about the course content.
△ ▽ • Reply • Share ›
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 ›
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 22/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
this.Retrieve();
Thanks!
△ ▽ • Reply • Share ›
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.
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.
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...
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:
△ ▽ • Reply • Share ›
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 ›
https://app.pluralsight.com/library/courses/skeet-async/table-of-contents
△ ▽ • Reply • Share ›
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!?
thank you
△ ▽ • Reply • Share ›
Search… SM
Let me know if that provides the information you were looking for.
△ ▽ • Reply • Share ›
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.
Javier
Skip to main content
△ ▽ • Reply • Share ›
Search… SM
Can I find a complete list of FAQ from all your courses anywhere? They are really helpful.
Thx
△ ▽ • Reply • Share ›
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 ›
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 ›
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 ›
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
Let me know if you don't get an answer and I will try from my end.
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?
Cheers!
△ ▽ • Reply • Share ›
Thanks again!
Skip to main content
△ ▽ • Reply • Share ›
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 ›
△ ▽ • Reply • Share ›
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.
- 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 ›
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 ›
Sergey.
△ ▽ • Reply • Share ›
Skip to main content
DeborahK89 > fuzzy_monster • 3 years ago
fuzzy_monster Thank you so much!
△ ▽ • Reply • Share ›
{
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 }
};
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
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 ›
Thanks so much!
Thanks!
△ ▽ • Reply • Share ›
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.
Search… SM
- Glen Read
△ ▽ • Reply • Share ›
- Glen
△ ▽ • Reply • Share ›
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.
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 ›
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
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 ›
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 ›
△ ▽ • Reply • Share ›
Product: Saw
Quantity: 12
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
I use Visual Studio Code in my "Angular with TypeScript" course ... but that really won
you if you aren't doing Angular.
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.
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.
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 ›
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
Search… SM
Course info
Level Beginner
Rating (627)
My rating
Duration 3h 35m
Share course
Get support
Send feedback
Features
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 39/40
8/11/2019 C# Best Practices: Collections and Generics | Pluralsight
Help center
How-to videos
Referral program
Terms of use
Privacy policy
https://app.pluralsight.com/library/courses/csharp-best-practices-collections-generics/discussion 40/40