Tim you might not ever read this comment, but I just want to tell you how incredibly thankful I am that I found your channel about 3 years ago. You have helped me develop into a very good senior programmer, I have a better job now with more money and I can't begin to tell you how much better my life has become after going through all your courses. I truly mean it. You're an incredible teacher.
It is October 2024 and this video and many others you´ve made have been very helpful. I am migrating from C++ and Visual Basic .NET and this is the best content I´ve found so far in the internet. I truly appreciate it.
31:32 - "Why not make everything public" I love the way Tim explains the same thing from different angles numerous times to solidify and crystalize the knowledge transfer so as to make it CONCRETE! This is a man who taught this stuff at the college level for more than 5 years. He's not only knowledgeable and understandable, but he really knows HOW TO TEACH. My only complaint is that he doesn't teach EVERYTHING.
That part is actually a lot of bullshit. Since when having the CC number as public is a security risk but having it private isn't? lol, I will easily get private stuff using reflection. The point of private stuff is to organize your code and your APIs, some stuff is too much implementation detail that it doesn't make sense to expose it, what it makes sense to expose you set it as public or internal, depending on what is your intention.
I have been a c# dev for over 10 years and I still enjoy your content. Especially with interview questions I have proper answers for interviewers. Thanks man you’re the best
There are those who gives meaning, and there are those who gives people a chance at a career for better lives, you are both, thank you so much Tim Corey, thank you.
Thanks for the vids, Tim! Whenever I google something specifically C# related I now add your name to it since you explain things so well. Thank you so much for providing amazing, clear, and useful explanations on these topics.
Thanks Tim. Appreciate all the time and effort put into this video to explain the concept of modifiers. Like your pace, the simple examples that make your videos stand out. What I like more is you getting into details when needed, explaining the WHY and WHERE - a developers dream come true (saving my search on google).
Best explanation of access modifiers, period. Thanks Tim, this video was massively helpful in helping me understand the use cases for each of these modifiers.
Thank you for this explanation. I took C++ in college many years ago but never really pursued a developer type career. Recently I have been rethinking that choice and it's clear videos like this that make a big difference for me. This not only explains the What and How for scope, but continues to explain Why it's important.
Tim, thank you for your videos and explanations. I've seen others who only explain the what and the how. You also explain the why with real world examples and I really appreciate that. Keep up the good work!
⭐️⭐️⭐️⭐️ star tutorial. You are the best in being capable to explain all the logic accurately and simply. This helps one to understand the complex logic easily and practicing helps a lot in consuming the knowledge better. Your approach in explaining first alongside showing it practically helps to visualise and consume the topic better. I'm more inclined to learn ideas and logics visually and this assited me to dive deep. Thank you for all your efforts. I will surely, go through all the topics in advanced C# playlist and expecting to evaluate and improve my existing skills.
Thank you so much for clarification Tim! It made it more clear. However I think that those private protected and protected internal are really exotic ones and I can’t imagine the case where one can need those access modifiers.
Awesome Tim, to be honest the hardest part for me is what you touched on at the end, piecing a project together and mapping things together, that's been one of the most confusing things in my journey to learn C# and .NET, can you recommend any vidoes that might help with this? Stuff like this one is great, where you have multiple assemblies and explain the modifiers and how they work in the different assemblies. Thought I'd ask if you have any videos on overall project structure and mapping things out, or the best practices for building different types of apps etc. especially web apps! Thanks for your help!
Tim you can start the story telling by saying access modifiers are a sort of selectivity and visibility based on functional needs of a system and describe the modifiers by giving context domain like the components of a car. This will help c# developers visualize the use case.
I don't believe so on RUclips. I cover that in my Foundation in C# course series. Basically, use properties whenever you need to make the data available outside the class (no public variables). As for static methods, you use them in a few cases, but mainly when you don't need to use them only in a specific instance of a class.
@@IAmTimCorey sorry if I was bit of a ambiguous. What I meant to ask was when to use static methods, static variables and static properties? I see those sometimes in my company's code base and they are sometimes a pain in the ass. Like if some configurations area loaded from config (basically xml) file to a private static variable, in order to get those configs to change for the web application, I have to restart the whole damn application. Sometimes I change them to public static variables so that I can make them changeable from other places without restarting the whole app.
This is one of those edge patterns that is only useful in a few scenarios. The basic idea is that you separate out your database read code from your database write code (vast over-simplification). There are very few cases where this separation adds value to your application but there are a lot of cases where you would cause more complexity without added value. There is a case for it, but I shy away from things that people will watch and then try to implement. It is almost certain that they will be implementing it in the wrong situation if they try to do so with CQRS (it is valuable typically in a part of a large, complex application).
Job interviews are tough. The interviewer needs to identify the most skilled person for the job but that really is subjective. They try to make it objective but that gets you poor results at best.
Thanks for that. I have to confess that I was guilty about using "public" and creating "global public" variables. I am learning to rethink things and make the accessing more stricter. I am working on redoing access modifiers. There was one class that I saw that uses "Sealed". Is that a popularly used one or one that is being discontinued?
Hi Tim. As all your videos this one is just amazing however I have a question about one more ?modifier? - static. How do I know where and when should I put it and what are the consequences of it? I don't know if You already covered it somewhere else - if so than sorry for asking in the wrong chapter. Thank You for the video once more.
I cover that in the Foundation in C# course series, but I don't think I have a specific video of it on RUclips. Basically, static means you cannot instantiate the class. You get one copy that everyone uses instead of creating instances. Default to instantiation unless there is a really good reason to use static.
Hey Tim, thanks a bunch for your comprehensive explanation about access modifiers, and for the time and effort you put into this 💪 I understood that the DRY principle is one of the most simple yet powerful principles to learn. What other principles do you recommend? Thanks in advance
Tim, is your main language C#? I think you really put out some great content. I'm at UNI studying towards MS stack and using a lot of your insights as an addition is so good to me. Thanks for your hard work, I hope you make plenty of money on it.
Right now, yes. However, that has fluctuated over the years depending on the needs of where I worked. It has almost always been a primary language of mine since it came out but I've worked heavily with JavaScript, SQL, C, C++, VB.NET, VB6, and more. Along the way, I've also worked in a bunch of secondary languages (Java, objectiveC, FoxPro, etc.) as well. The trick is to learn one language well and get really familiar with the concepts of development. Then you can much more easily switch languages because it is a similar expression of logic with just a change in syntax. The harder transitions are OOP to functional languages, but you still have a good base to work with.
I used to think why bother I’m the only developer, who cares if it’s public or private or protected for a small app _ then my friend ripped apart my app showing me all my classes using reflection and a decompiler. Lesson learned!
I just stumbled over your channel and so far really enjoy it. A thought about accesss modifyers: Would't event be an access modifyer which makes a field of a delegate type accessible externally with += and -= only? I at leas like to think about it that way.
It's probably me who didn't fully understand this, but isn't he making a mistake at 21:40? Shouldn't protected internal behave as internal in its own assembly and as protected for any other assemblies? And not the other way around as he is saying?
Hi, Tim, when experimenting on my own in the Visual Studio, I notice that protected private also works, then I searched the web but no where to be found, could you explain a little? (I also realize that private internal equals internal, so there is no such thing) 🤠
I've only known your channel for a few days but I've already watched a lot of your videos. Thank you for your great videos, even after many years as a programmer I can still learn something from you. I have a question for which I haven't found a video from you yet, but maybe I just haven't watched the right video yet. I would be interested to know if you think it makes sense to use private properties instead of private fields? In the application framework in which I mainly work, it has become common practice that private fields are hardly ever used. And I still don't know whether that makes sense or not. Or whether it actually makes a difference. Many thanks and best regards Peter
There are only a couple of reasons I can see to use private properties: 1 - If you are expecting to make them public someday. 2 - If you want to limit the input/output of them. Otherwise, I do not see the benefits. I would ask them what benefits the private properties give them over private fields.
@@IAmTimCorey thanks a lot for your reply! It is so great that you take the time to answer all these questions. I will ask them because in most cases it really makes no sense to me - thanks!!
Great video, as always! But maybe you can help me figure out... What's the default access state of a class? It is not public, but also not private. I've noticed that a class without any access modifier can be used inside the project(assemly), but not outside of it. So it looks like all classes are internal by default (if they have no other modifiers). Am I right?
"An access modifier in C# specifies who can see and use a resource." Just what I was looking for. But nothing in the first part of video builds on this. What do I need to look for in order to find information about limiting access to private pages to the page owner?
Pages? Do you mean classes or are you talking ASP.NET? If the former, this video covers that. It walks through your options and which ones give who access. If the latter, that's a different technology.
@@IAmTimCorey No. I dont mean classes. And no, not ASP.NET. I need to let users create content and have them store that content and review it later. What kind of structure is less important, but i need to control the access. So pages, content, endpoints or what you want to call it, but data that I can "specify who can see and use".
So what you are looking for is authentication and authorization. I do have videos on that for ASP.NET MVC as well as the TimCo Retail Manager, which uses WebAPI and has auth on a WPF app.
Just out of interest, do internal classes have any added benefits to a "normal" class (i.e a non-public class), or are "normal" classes marked internal by default.
If your the only developer on a project is the private mindset that important? I was under the impression that once compiled methods wouldn't be accessible.
I think it's very easy to understand these , but for beginners it's better to offter a nested scope graph to explain these keywords's functional scope.
*private* (outer) *protected* (inner) -> It behaves as *private* from outside the assembly and *protected* from inside the assembly *protected* (outer) *internal* (inner) -> It behaves as *protected* from outside the assembly and *internal* from inside the assembly
The first is a field, the second is a property. You cannot bind to a field. You also cannot protect a field like you can with a property. Also, if you change a field in any way, it requires you to recompile all applications that depend on that field. This is not true with properties. The list goes on, but the basic answer is to not use public fields, only public properties.
It is a modifier (like abstract, async, const, and more) but it is not an access modifier. Access modifiers determine who can see/use an item. Readonly doesn't restrict who can see it/use it but rather how it can be used.
@@josephmarsh5031 the keyword "readonly" is used to declare an immutable variable. i.e. A variable whose value, once assigned, cannot be changed. It's a modifier but not an access modifier!)
Public and Private are definitely useful and necessary. Protect and Internal can be used to cover some edge cases, nice to have in real life. The other two are just dumb ideas in my opinion
Hi Tim, why don't you create courses on Udemy. Create a full project. Windows first, ASP.NET MVC second and then with that introduce SOLID principles, also including good programming techniques, add then WCF, WEB API and spread out using these projects as a basis for another course on MicroServices. Just a suggestion. I always pay for courses on Udemy and they are affordable. Thanks for this video. Take care.
I did offer a course on Udemy: www.udemy.com/course/which-aspnet-core/?couponCode=MOVINGSALE The experiment did not go well, unfortunately, and I won't be offering more courses on the platform. I see about 16% of the income of what I see on my site and no, the number of people who buy my course does not make up for it. Total income is about 30% of what I would get on my site and I more than double my support needs.
If you have not already, please consider checking out this video - ruclips.net/video/LUv20QxXjfw/видео.html It is intended to help you assess where you are and the topics you need to add to your base skills. I hope it will help you fill in any gaps. My goal is to make becoming a developer easier and I hope I can help you be successful through your full journey!
Methods are inside Classes. Most people only use Public and Private Methods. Public and Private are Modifiers to Allow or Block Access to them. Tim shows how to use Methods that can share functionality and data. These are called ACCESS MODIFIERS. He talks about 13 different types.
I'm curious if you actually watched the video fully or just assumed you know it. For instance, do you understand the difference between protected internal and private protected? That's a simple concept to you? If so, I'm not sure why you were watching the video in the first place. And by the way, it only took 22 minutes to cover access modifiers as concepts (private, public, protected, private protected, and protected internal). The rest of the video was on how to use these in the real world and why we don't just use public and private for everything.
@@IAmTimCoreydon’t listen to such people Tim. You videos have an excellent length and explain things very thoroughly and I am sure that many people like me just like it that way.
I don’t understand why I don’t just make everything public so I don’t have to deal with this. I’m sure there’s a reason, I just don’t get it. This seems like extra work for nothing.
I think you meant to say, "Too complicated explanation". "To" is a preposition, whereas, "Too" is a Modifier, like Tim explains so well. You would use "To" to explain a place you are going like the place you are going to be free. Now, go, be free.
Tim you might not ever read this comment, but I just want to tell you how incredibly thankful I am that I found your channel about 3 years ago. You have helped me develop into a very good senior programmer, I have a better job now with more money and I can't begin to tell you how much better my life has become after going through all your courses. I truly mean it. You're an incredible teacher.
I appreciate the kind words. I'm glad my content has been so helpful to you. Thanks for sharing!
It is October 2024 and this video and many others you´ve made have been very helpful. I am migrating from C++ and Visual Basic .NET and this is the best content I´ve found so far in the internet. I truly appreciate it.
Just... Thank you for existing.
lol thanks.
Lol, I'm going to start saying this
thank his parents
😂... Really!
Thanks!
Thank you!
Dude.. Im just 9 minutes into the video and I just discover you’re the best teacher of the universe.
31:32 - "Why not make everything public"
I love the way Tim explains the same thing from different angles numerous times to solidify and crystalize the knowledge transfer so as to make it CONCRETE!
This is a man who taught this stuff at the college level for more than 5 years. He's not only knowledgeable and understandable, but he really knows HOW TO TEACH.
My only complaint is that he doesn't teach EVERYTHING.
I'm thinking about expanding into courses on hair styling.
@@IAmTimCorey It'd be HARD to practice on us.
That part is actually a lot of bullshit. Since when having the CC number as public is a security risk but having it private isn't? lol, I will easily get private stuff using reflection. The point of private stuff is to organize your code and your APIs, some stuff is too much implementation detail that it doesn't make sense to expose it, what it makes sense to expose you set it as public or internal, depending on what is your intention.
I have been a c# dev for over 10 years and I still enjoy your content. Especially with interview questions I have proper answers for interviewers. Thanks man you’re the best
Great to hear!
There are those who gives meaning, and there are those who gives people a chance at a career for better lives, you are both, thank you so much Tim Corey, thank you.
Thank you, that is very gracious and much appreciated.
I couldn't wrap my head around internals, but now I understand! So many people just say "assembly" and expect me to know what it means!
I am glad it was so helpful.
You are the best C# Tutor in the entire Planet
I appreciate the kind words.
Thanks for the vids, Tim! Whenever I google something specifically C# related I now add your name to it since you explain things so well. Thank you so much for providing amazing, clear, and useful explanations on these topics.
Awesome! I’m glad my content has been so helpful.
He's gladly sharing his knowledge and making good use of his Microsoft MVP status...
Better than my half year part of university education about OOP . Makes more sense and clear thanks.
I am glad it was clear.
Best explanation of Access Modifiers I have ever come across ! Thank you Tim !
You are welcome.
Thanks Tim. Appreciate all the time and effort put into this video to explain the concept of modifiers. Like your pace, the simple examples that make your videos stand out. What I like more is you getting into details when needed, explaining the WHY and WHERE - a developers dream come true (saving my search on google).
I am glad you get that much value out of my content.
Best teacher ever! Thank you.
You're very welcome!
Best explanation of access modifiers, period. Thanks Tim, this video was massively helpful in helping me understand the use cases for each of these modifiers.
Glad it was helpful!
Thank you for this explanation. I took C++ in college many years ago but never really pursued a developer type career. Recently I have been rethinking that choice and it's clear videos like this that make a big difference for me. This not only explains the What and How for scope, but continues to explain Why it's important.
I am glad it was helpful.
Thanks Tim. I came back to this again as I felt confused about how it relates to Unit tests where the code m
You are welcome.
Tim, thank you for your videos and explanations. I've seen others who only explain the what and the how. You also explain the why with real world examples and I really appreciate that. Keep up the good work!
You are most welcome. Thanks for watching.
Dude your tutorials are just amazing. Life saver for upcoming internship^^
Best wishes on your internship.
Thank you for everything you do.❤ lot of love towards your hard work and dedication in teaching us (your pupils)
You are welcome.
⭐️⭐️⭐️⭐️ star tutorial. You are the best in being capable to explain all the logic accurately and simply. This helps one to understand the complex logic easily and practicing helps a lot in consuming the knowledge better. Your approach in explaining first alongside showing it practically helps to visualise and consume the topic better. I'm more inclined to learn ideas and logics visually and this assited me to dive deep. Thank you for all your efforts. I will surely, go through all the topics in advanced C# playlist and expecting to evaluate and improve my existing skills.
You are welcome.
Such a great video. It cleared all of my confusions regarding access modifiers and I believe i can make effective use of it. Thank you.
That's great to hear, thanks for sharing.
You're so right about forgetting to use 'internal'. I'm going to update my code today.
I am glad it was helpful.
Another excellent and clearly explained video. Massive thumbs up! Thanks Tim.
You are welcome.
ProtectedInternal -> Protected OR Internal
PrivateProtected -> Private AND Protected
👍
PrivateProtected -> Private AND Protected - but only in the assembly in which it was declared
Bro I just love your detailed explanation it helps a lot in building concepts
Thanks!
Comprehensive and best video on the topic ❤
Thanks!
I learnt using propfull from this video, thanks for a great video.
Excellent!
Thank you so much for clarification Tim! It made it more clear.
However I think that those private protected and protected internal are really exotic ones and I can’t imagine the case where one can need those access modifiers.
They aren't as commonly used.
Awesome explanation
Thanks! And Merry Christmas
You are welcome.
Cool video, thanks!
You are welcome.
Very useful. Clear and concise. Thanks Tim
Glad it was helpful!
@@IAmTimCorey It really was. Love your channel Tim, keep up the good work :)
Really an extraordinary explanation along with demos 🙏🙏🙏
Thanks for investing your time with Tim
very helpful thanks
You are welcome.
Thank You Tim for sharing your experience with us!
My pleasure!
This was a really good video. Thanks for the examples.
You are welcome.
Love you man!!
Thanks!
Awesome Tim, to be honest the hardest part for me is what you touched on at the end, piecing a project together and mapping things together, that's been one of the most confusing things in my journey to learn C# and .NET, can you recommend any vidoes that might help with this? Stuff like this one is great, where you have multiple assemblies and explain the modifiers and how they work in the different assemblies. Thought I'd ask if you have any videos on overall project structure and mapping things out, or the best practices for building different types of apps etc. especially web apps! Thanks for your help!
Thank you very much, Tim, very helpful and easy tutorial for a complex subject
Glad to hear it
Tim you can start the story telling by saying access modifiers are a sort of selectivity and visibility based on functional needs of a system and describe the modifiers by giving context domain like the components of a car. This will help c# developers visualize the use case.
Thanks for sharing.
I am so gonna watch all the videos
Best of luck. There's over 250 of them. 😂
Thank you so much. You are a great teacher.
You are welcome.
Amazing explanation. Thank you very much!
You are welcome!
Very helpful. Thanks!
You're welcome!
thank you so much!! you clear all my confusion.
Tim loves to help folks be successful. Thanks for watching.
Thanks so much Tim. God Bless You.
You are very welcome
Great and easy to understand explanations. Do u have tutorial about when to use static methods and variables and properties?
I don't believe so on RUclips. I cover that in my Foundation in C# course series. Basically, use properties whenever you need to make the data available outside the class (no public variables). As for static methods, you use them in a few cases, but mainly when you don't need to use them only in a specific instance of a class.
@@IAmTimCorey sorry if I was bit of a ambiguous. What I meant to ask was when to use static methods, static variables and static properties? I see those sometimes in my company's code base and they are sometimes a pain in the ass. Like if some configurations area loaded from config (basically xml) file to a private static variable, in order to get those configs to change for the web application, I have to restart the whole damn application. Sometimes I change them to public static variables so that I can make them changeable from other places without restarting the whole app.
Which kind of defeats the whole purpose of configs that can be changed from the fly as the application is running.
thank you this was so helpful
You are welcome.
Hi Tim, what do you think of CQRS (Common Query Responsibility Segregation)? Could be a good topic for your upcoming videos?
This is one of those edge patterns that is only useful in a few scenarios. The basic idea is that you separate out your database read code from your database write code (vast over-simplification). There are very few cases where this separation adds value to your application but there are a lot of cases where you would cause more complexity without added value. There is a case for it, but I shy away from things that people will watch and then try to implement. It is almost certain that they will be implementing it in the wrong situation if they try to do so with CQRS (it is valuable typically in a part of a large, complex application).
I agree, and I don't understand why is so requested in job interviews.
Job interviews are tough. The interviewer needs to identify the most skilled person for the job but that really is subjective. They try to make it objective but that gets you poor results at best.
Thanks for that. I have to confess that I was guilty about using "public" and creating "global public" variables. I am learning to rethink things and make the accessing more stricter. I am working on redoing access modifiers. There was one class that I saw that uses "Sealed". Is that a popularly used one or one that is being discontinued?
It is still used but it is a niche use. Sealed means other classes cannot inherit from the class.
So basically everything that is internal can be accessed in every other class as long as its in the same namespace?
Basically, yes
Hi Tim. As all your videos this one is just amazing however I have a question about one more ?modifier? - static. How do I know where and when should I put it and what are the consequences of it? I don't know if You already covered it somewhere else - if so than sorry for asking in the wrong chapter. Thank You for the video once more.
I cover that in the Foundation in C# course series, but I don't think I have a specific video of it on RUclips. Basically, static means you cannot instantiate the class. You get one copy that everyone uses instead of creating instances. Default to instantiation unless there is a really good reason to use static.
Hey Tim, thanks a bunch for your comprehensive explanation about access modifiers, and for the time and effort you put into this 💪
I understood that the DRY principle is one of the most simple yet powerful principles to learn.
What other principles do you recommend?
Thanks in advance
I also recommend checking out SOLID: ruclips.net/p/PLLWMQd6PeGY3ob0Ga6vn1czFZfW6e-FLr
Tim, is your main language C#? I think you really put out some great content. I'm at UNI studying towards MS stack and using a lot of your insights as an addition is so good to me. Thanks for your hard work, I hope you make plenty of money on it.
Right now, yes. However, that has fluctuated over the years depending on the needs of where I worked. It has almost always been a primary language of mine since it came out but I've worked heavily with JavaScript, SQL, C, C++, VB.NET, VB6, and more. Along the way, I've also worked in a bunch of secondary languages (Java, objectiveC, FoxPro, etc.) as well. The trick is to learn one language well and get really familiar with the concepts of development. Then you can much more easily switch languages because it is a similar expression of logic with just a change in syntax. The harder transitions are OOP to functional languages, but you still have a good base to work with.
Thank you 👍
You are welcome
yeah, who does inheritance in oop language anyway right?
It isn’t as common as people initially think , but it is still something that you do. Why?
I used to think why bother I’m the only developer, who cares if it’s public or private or protected for a small app _ then my friend ripped apart my app showing me all my classes using reflection and a decompiler. Lesson learned!
Yep, it can be a big problem.
I just stumbled over your channel and so far really enjoy it.
A thought about accesss modifyers: Would't event be an access modifyer which makes a field of a delegate type accessible externally with += and -= only? I at leas like to think about it that way.
Delegates/events have access modifiers of their own in order to control that.
nice work
Thank you!
It's probably me who didn't fully understand this, but isn't he making a mistake at 21:40? Shouldn't protected internal behave as internal in its own assembly and as protected for any other assemblies? And not the other way around as he is saying?
Hi tim please made a video on c# sockets.. RUclips don't have any good videos on sockets topic .. So please consider this topic.
I'll add it to the list of suggested topics.
IAmTimCorey Thanku
Very nice, Thank you.
You are welcome.
Hi, Tim, when experimenting on my own in the Visual Studio, I notice that protected private also works, then I searched the web but no where to be found, could you explain a little? (I also realize that private internal equals internal, so there is no such thing) 🤠
I've only known your channel for a few days but I've already watched a lot of your videos. Thank you for your great videos, even after many years as a programmer I can still learn something from you.
I have a question for which I haven't found a video from you yet, but maybe I just haven't watched the right video yet. I would be interested to know if you think it makes sense to use private properties instead of private fields? In the application framework in which I mainly work, it has become common practice that private fields are hardly ever used. And I still don't know whether that makes sense or not. Or whether it actually makes a difference.
Many thanks and best regards Peter
There are only a couple of reasons I can see to use private properties:
1 - If you are expecting to make them public someday.
2 - If you want to limit the input/output of them.
Otherwise, I do not see the benefits. I would ask them what benefits the private properties give them over private fields.
@@IAmTimCorey thanks a lot for your reply! It is so great that you take the time to answer all these questions. I will ask them because in most cases it really makes no sense to me - thanks!!
Very nice
Thanks
@Tim, Wondering if you have a video on Partial classes and structs. A video on those will be useful. Thanks.
Not yet but I can add them to the list.
@@IAmTimCorey thanks!
Hey Tim... Just a question out of curiosity.... Is it rational to use "protected" along with some inheritance rather than using "public"?
Great video, as always! But maybe you can help me figure out... What's the default access state of a class? It is not public, but also not private. I've noticed that a class without any access modifier can be used inside the project(assemly), but not outside of it. So it looks like all classes are internal by default (if they have no other modifiers). Am I right?
Correct. A class is "internal" by default.
@@IAmTimCorey But then nested classes can be private, right ? And what can be the use of it ? (Since it is allowed)
thanks
Welcome
"An access modifier in C# specifies who can see and use a resource."
Just what I was looking for. But nothing in the first part of video builds on this.
What do I need to look for in order to find information about limiting access to private pages to the page owner?
Pages? Do you mean classes or are you talking ASP.NET? If the former, this video covers that. It walks through your options and which ones give who access. If the latter, that's a different technology.
@@IAmTimCorey No. I dont mean classes. And no, not ASP.NET. I need to let users create content and have them store that content and review it later. What kind of structure is less important, but i need to control the access.
So pages, content, endpoints or what you want to call it, but data that I can "specify who can see and use".
So what you are looking for is authentication and authorization. I do have videos on that for ASP.NET MVC as well as the TimCo Retail Manager, which uses WebAPI and has auth on a WPF app.
@@IAmTimCorey Thank you! It is so hard to find the relevant information, if you dont know the right phrases to search for.
Just out of interest, do internal classes have any added benefits to a "normal" class (i.e a non-public class), or are "normal" classes marked internal by default.
Nope. Internal is implied if you don’t specify something different.
If your the only developer on a project is the private mindset that important? I was under the impression that once compiled methods wouldn't be accessible.
They are accessible even after being compiled.
@@IAmTimCorey Ok, the added private mindset makes sense then. Thank you for the reply.
I think it's very easy to understand these , but for beginners it's better to offter a nested scope graph to explain these keywords's functional scope.
*private* (outer) *protected* (inner) -> It behaves as *private* from outside the assembly and *protected* from inside the assembly
*protected* (outer) *internal* (inner) -> It behaves as *protected* from outside the assembly and *internal* from inside the assembly
Thanks for sharing.
Never knew 40minutes could feel so short for a coding video
Thanks
someone asked me how we can do calculation on numbers, which are beyond the limit of variable ? could you please suggest me from where can learn it
biginteger, bigrational
@@_grzehotnik thanks , will explore these topics, It would be really helpful for me If you make a video on it. Thanks
god bless you
Thank you!
whats the difference between
public string str; and public string str { get; set; }
The first is a field, the second is a property. You cannot bind to a field. You also cannot protect a field like you can with a property. Also, if you change a field in any way, it requires you to recompile all applications that depend on that field. This is not true with properties. The list goes on, but the basic answer is to not use public fields, only public properties.
@@IAmTimCorey oh wow. I love the detailed explanation. Thank you sir 🙂
I think a venn diagram is in order.
Is "readonly" not an access modifier?
It is a modifier (like abstract, async, const, and more) but it is not an access modifier. Access modifiers determine who can see/use an item. Readonly doesn't restrict who can see it/use it but rather how it can be used.
IAmTimCorey ah... thanks!
@@josephmarsh5031 the keyword "readonly" is used to declare an immutable variable. i.e. A variable whose value, once assigned, cannot be changed. It's a modifier but not an access modifier!)
I live in Russia private static Hell.
Anyone inviting me to a public US class?
Ha ha! Nice joke! It depends only on you if you can refactor this class to become public 😅It seems like US class is closed for modification already 😊
You missed Sealed
Yep.
Public and Private are definitely useful and necessary. Protect and Internal can be used to cover some edge cases, nice to have in real life. The other two are just dumb ideas in my opinion
They all have their uses. Some are just more common than others.
You rockkkkk
I roll with it. LOL - Thanks.
You forgot the sealed class modifier.
Sealed is a keyword, but it is not considered an access modifier.
Hi Tim, why don't you create courses on Udemy. Create a full project. Windows first, ASP.NET MVC second and then with that introduce SOLID principles, also including good programming techniques, add then WCF, WEB API and spread out using these projects as a basis for another course on MicroServices. Just a suggestion. I always pay for courses on Udemy and they are affordable. Thanks for this video. Take care.
I did offer a course on Udemy: www.udemy.com/course/which-aspnet-core/?couponCode=MOVINGSALE
The experiment did not go well, unfortunately, and I won't be offering more courses on the platform. I see about 16% of the income of what I see on my site and no, the number of people who buy my course does not make up for it. Total income is about 30% of what I would get on my site and I more than double my support needs.
22:00
You not explain first I don't understand 😐
If you have not already, please consider checking out this video - ruclips.net/video/LUv20QxXjfw/видео.html It is intended to help you assess where you are and the topics you need to add to your base skills. I hope it will help you fill in any gaps. My goal is to make becoming a developer easier and I hope I can help you be successful through your full journey!
Methods are inside Classes. Most people only use Public and Private Methods. Public and Private are Modifiers to Allow or Block Access to them. Tim shows how to use Methods that can share functionality and data. These are called ACCESS MODIFIERS. He talks about 13 different types.
bro 46 minutes for one simple concept, no thanks. You made it as confusing as possible and as long winded as possible.
I'm curious if you actually watched the video fully or just assumed you know it. For instance, do you understand the difference between protected internal and private protected? That's a simple concept to you? If so, I'm not sure why you were watching the video in the first place. And by the way, it only took 22 minutes to cover access modifiers as concepts (private, public, protected, private protected, and protected internal). The rest of the video was on how to use these in the real world and why we don't just use public and private for everything.
@@IAmTimCoreydon’t listen to such people Tim. You videos have an excellent length and explain things very thoroughly and I am sure that many people like me just like it that way.
I don’t understand why I don’t just make everything public so I don’t have to deal with this. I’m sure there’s a reason, I just don’t get it. This seems like extra work for nothing.
Oh. Here we go.
I am glad you figured it out
@@IAmTimCorey I am glad I had your help.
TO complicated explantaion
Have you found a simpler way to explain it? These are complicated topics.
I think you meant to say, "Too complicated explanation". "To" is a preposition, whereas, "Too" is a Modifier, like Tim explains so well. You would use "To" to explain a place you are going like the place you are going to be free. Now, go, be free.