12. How to program in C# - ENUMS - Beginner Tutorial

  Рет қаралды 197,799

Brackeys

Brackeys

Күн бұрын

Пікірлер: 195
@HappyKiller1O1
@HappyKiller1O1 8 жыл бұрын
I find it funny how you swear in the middle of the video, out of no where to express your point. Hope your channel grows!
@FirstLast-ws7zw
@FirstLast-ws7zw 8 жыл бұрын
+HappyKiller1O1 Hey what language did you learn before ? i see you moving rocket fast!!!
@HappyKiller1O1
@HappyKiller1O1 8 жыл бұрын
energy can neither be created nor destroyed I am very fluent in Java, and need to learn C# for some scripting in Unity. Once you understand Java, the fundamentals of C# become quite basic. :P
@FirstLast-ws7zw
@FirstLast-ws7zw 8 жыл бұрын
+HappyKiller1O1 Amazing!! I heard that in some forums too once you master java you already know 90% of c# XD! I am going slow as it is one of my first language(First is HTML):(. Good luck with your scripting!
@HappyKiller1O1
@HappyKiller1O1 8 жыл бұрын
energy can neither be created nor destroyed If you start having trouble, try messing around with Minecraft modding. You can learn A LOT of Java by doing that, and a lot of useful tricks. Good luck to you too!
@shubhsharma2755
@shubhsharma2755 8 жыл бұрын
Bro HTML was my first language but i may correct you it's not a programming language. It's a markup language. It cant perform logic and other things. My first real programming language is c++ and I find it much easier than c#. If you learn that you already know how all languages work fundamentally.
@TheBellite
@TheBellite 8 жыл бұрын
Enums, making code not easy to "fuck up". I love this guy, subscribed.
@dgudovic
@dgudovic 8 жыл бұрын
Your voice is so calming, and your teaching ways have so far been proven to work exceptionaly, at least for me, please continue with this series, it's helping my education a whole lot.
@psis6786
@psis6786 7 жыл бұрын
dgudovicddd yea so calming 7:34 :)
@ethansantiago7013
@ethansantiago7013 5 жыл бұрын
I think everyone was like "wait, did he just swear?"
@ThatGuyDownInThe
@ThatGuyDownInThe 4 жыл бұрын
lol
@thatsalot3577
@thatsalot3577 3 жыл бұрын
I just scrolled the comment section after that.
@7empest_mi
@7empest_mi 3 жыл бұрын
hahaha, exactly
@vanshyadav4533
@vanshyadav4533 6 жыл бұрын
I used to watch your videos 4 years ago in 2013, Just came back, so much nostalgia, it just calms me for some reason
@enemydisabler2707
@enemydisabler2707 9 жыл бұрын
Don't forget to like this video, people have no idea how important support is!
@Brackeys
@Brackeys 9 жыл бұрын
Enemydisabler Thanks for caring! :D
@magnusm4
@magnusm4 9 жыл бұрын
+Enemydisabler source to your picture please?
@enemydisabler2707
@enemydisabler2707 9 жыл бұрын
magnusm4 I'm really sorry but i can't remember where I got it from.
@magnusm4
@magnusm4 9 жыл бұрын
Enemydisabler dammit -_-
@justmark8040
@justmark8040 8 жыл бұрын
+magnusm4 yt3.ggpht.com/-AmFKgub5RXE/AAAAAAAAAAI/AAAAAAAAAAA/pdBo9u4Jfa4/s48-c-k-no/photo.jpg You just have to click on Inspect Element and you will find it
@crystalsoulslayer
@crystalsoulslayer 7 жыл бұрын
Glad I found these tutorials! There are times when the MSDN site can only explain so much. Thanks for sharing your knowledge.
@jessepaulsen973
@jessepaulsen973 Жыл бұрын
"and not 'fuck up' so to say" had me rolling. Just the delivery bro. Great comedic timing.
@jamesinbou
@jamesinbou 9 жыл бұрын
You explained it a lot easier and faster than my professor. Thanks a bunch! Your humor's refreshing as well.
@I.D.M.
@I.D.M. 6 жыл бұрын
This is what I managed to take away from the explanation. Enums are a way write more readable code and a way to code a faster if you're willing to set up an enum. Great video.
@107688
@107688 8 жыл бұрын
DAMN i chuckled hard at 7:34 hahha
@illegalrepost213
@illegalrepost213 5 жыл бұрын
Me too I chuckled so fucking hard
@skuffd-semicolon
@skuffd-semicolon 5 жыл бұрын
@@illegalrepost213 It was so unexpected XD
@mrkewi1
@mrkewi1 4 жыл бұрын
@@rswa mee too
@Layarion
@Layarion 7 жыл бұрын
i like hearing the clicky of the keyboard.
@龙雨-i6o
@龙雨-i6o 4 жыл бұрын
I know right
@lampewick344
@lampewick344 7 жыл бұрын
Upvoted for the swear word
@SubscribersWithNoVideos-cn4nk
@SubscribersWithNoVideos-cn4nk 4 жыл бұрын
Reddit moment
@vylemsobotka3653
@vylemsobotka3653 6 жыл бұрын
"I was really busy" (Notice heartstone new on screen )
@sergiorodrigo6504
@sergiorodrigo6504 7 жыл бұрын
In my opinion it's like an array and some switch I found this program out there I hope you find it useful using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { /* The enum keyword is used to declare an enumeration, a distinct type that consists of a set of named constants called the enumerator list. ... Usually it is best to define an enum directly within a namespace so that all classes in the namespace can access it with equal convenience.*/ public enum Days : int {Monday = 1, Tuesday, Wednesday, Thursday = 90, Friday, Saturday, Sunday}; static void Main(string[] args) { var day = Days.Monday; Console.WriteLine ($"{day}"); Console.WriteLine ($"{(int) day}"); Console.WriteLine ($"{(Days) 3}"); Console.WriteLine ($"{(int) Days.Monday}"); Console.WriteLine ($"{(int) Days.Tuesday}"); Console.WriteLine ($"{(int) Days.Wednesday}"); Console.WriteLine ($"{(int) Days.Thursday}"); Console.WriteLine ($"{(int) Days.Friday}"); Console.WriteLine ($"{(int) Days.Saturday}"); Console.WriteLine ($"{(int) Days.Sunday}"); foreach (var theEnum in Enum.GetValues(typeof(Days))) { Console.WriteLine ($"{(theEnum)}"); } if (day == Days.Monday) { Console.WriteLine ("The conditional was activated"); } } } }
@marhsall-bw5kv
@marhsall-bw5kv 9 жыл бұрын
very nice explanation of Enum..I really like how you compared Switch to Enum to show the advantage of Enum over switch..
@zerosandones7547
@zerosandones7547 3 жыл бұрын
ENUMERATIONS: - a type consisting of a bunch of constants that we associate with a name - the main purpose of enumerations is to replace the numeric values, which we would use, if there were no enumeration types. In this way the code becomes simpler and easier to read. public enum CoffeeSize { Small=100, Normal=150, Double=300 } instead of: const int coffeeSizeSmall = 100; const int coffeeSizeNormal = 150; const int coffeeSizeDouble = 300; - an enumeration is like a class, but we can only declare constants in an enum - the constants of enumerations can be used in switch-case structures public double CalcPrice(CoffeeSize coffeeSize) { switch (coffeeSize) { case CoffeeSize.Small: return 0.20; case CoffeeSize.Normal: return 0.40; case CoffeeSize.Double: return 0.60; default: throw new InvalidOperationException("Unsupported coffee quantity: " + (int)coffeeSize); } } [ As we can see in this example, the possibility for the users of our method to provoke unexpected behavior of the method is negligible, because we force them to use specific values as arguments, namely constants of enumerated CoffeeSize type. This is one of the advantages of constants, which are declared in enumeration types to constants declared in any class. ] - enumerations can take values only from the constants listed in the type - an enumerated variable can have as a value one of the listed in the type constants but cannot have value null - enumerations are a set of constants of type - this listed type (in the example below the type is Day) enum Day { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday } - each constant, which is declared in one enumeration, is being associated with a certain integer[as their index] (if they are not explicity assigned) (like in array, it starts with 0) in the example above, Friday is 5 and Monday is 1. - it is possible to change the numerical value of constants in an enumeration - e.g. Sunday = 10 (so the value of Sunday will be 10 instead of 0, the rest of the days following will be Monday = 11, Tuesday = 12 and so on...) [we can only assing integers as values to the constants] - enums can also be used like this: public enum CoffeeSize //in CoffeeSizes.cs { Small=100, Normal=150, Double=300 } //called in Cofee.cs public CoffeeSize size; public Coffee(CoffeeSizes size) { this.size = size; } public CoffeeSize Size { get { return size; } } Coffee normalCoffee = new Coffee(CoffeeSize.Normal); Console.WriteLine($"The {normalCoffee.Size} coffee is {(int)normalCoffee.Size} ml."); //prints: The Normal cofee is 150 ml. - Whenever possible, use enumerations instead of set of constants declared in a class.
@benjaminlavigne2272
@benjaminlavigne2272 8 жыл бұрын
Thanks for tuning in at brackeyss
@pipeman6631
@pipeman6631 4 жыл бұрын
scary shit man
@kingn125
@kingn125 7 жыл бұрын
thanks for your c# videos. by far one of the best in the net. you helped me alot :)
@tr3363
@tr3363 6 жыл бұрын
Excellent work you got me to programming again. I was learning python few months ago but I still wanted to learn something like C# or C++ Thank you for doing this tutorials! ;)
@dalicho29
@dalicho29 7 жыл бұрын
OMG! Finally I undestood the concept with example of ENUMS, ty!
@IchorX
@IchorX 5 жыл бұрын
7:34 really surprised me, that just came out of nowhere lmao.
@kimcorson4458
@kimcorson4458 3 жыл бұрын
i love brackeys. he's a great teacher!
@JonnyRocksAW
@JonnyRocksAW 3 жыл бұрын
The most intellectual "fuck-up" you'll ever hear.
@zeroskill990
@zeroskill990 4 жыл бұрын
Solid video and examples. Keep up the great work!
@JasperLaw
@JasperLaw 9 жыл бұрын
Thanks brackeys! I adore this series, can't wait until the next episode! :D
@Layarion
@Layarion 7 жыл бұрын
Cool.This is a good video; clear, simple, and mostly to the point.
@utkuliceli5066
@utkuliceli5066 7 жыл бұрын
I laughed way too hard at that chihuahua joke. Love the videos bro and the way you examplify uses for each and everything. Thanks.
@bip901
@bip901 5 жыл бұрын
I entered this video just to hear you say "enum" :D I always said it as in the beginning of "Enumerator" until someone laughed at my pronunciation...
@mathiasnielsen703
@mathiasnielsen703 8 жыл бұрын
Det er nogle lækre guides du har lavet dig. god til lige at få genopfrisket med. Også er det sjovt og se hvordan du får flere og flere programmer på dit skrivebord efter hver video. Især nu hvor du fik installeret Heartstone ^.^
@Tony-eh2ul
@Tony-eh2ul 8 жыл бұрын
chihuahua is ANGRY chihuahua SMASH :D
@DarrinLin
@DarrinLin 9 жыл бұрын
Is there a reason why you chose to define your classes inside your MainClass?
@saifalramahi9046
@saifalramahi9046 9 жыл бұрын
+Darrin Lin yeah i need to know too
@nookiejj
@nookiejj 9 жыл бұрын
+Darrin Lin I think it is more easy to have everything in 1 file when tutoring people through a video. It eliminates having the tutor constantly switch through files.
@DarrinLin
@DarrinLin 9 жыл бұрын
tislars I see, thanks. I think this would be a good thing to mention in the video.
@Sebruzz
@Sebruzz 8 жыл бұрын
Cool tutorial as always... However, I ended up scrolling dog breeds for hours ;D
@footsoldier12x
@footsoldier12x 6 жыл бұрын
Great video, you explain things really well. Thanks.
@johnsmithee6660
@johnsmithee6660 4 жыл бұрын
Instead of Brackeys, this channel should now be called 'Fuck'eys
@zakkhan4393
@zakkhan4393 8 жыл бұрын
Thank you very much for your tutorials they help out a lot
@naushsiddique6422
@naushsiddique6422 9 жыл бұрын
Found it very helpful. Thanks Brackeys !!!
@chaolihai-innit
@chaolihai-innit 9 жыл бұрын
He's obsessed with dogs. Awesome
@Tektron-inc
@Tektron-inc 6 жыл бұрын
Thanks for the video, it was useful for me.
@lautarogarcia8038
@lautarogarcia8038 4 жыл бұрын
Starts at 1:00
@cyborg6294
@cyborg6294 7 жыл бұрын
Thank you so much, you have a real talent.
@bamcodes
@bamcodes 9 жыл бұрын
Thanks man , this video is very helpful (y).
@CM-ng1ef
@CM-ng1ef 9 жыл бұрын
Great tutorial brackeys ! Keep it up!
@satk4211
@satk4211 4 жыл бұрын
Awesome man thank you!!!!
@jonathanbourgoin8063
@jonathanbourgoin8063 4 жыл бұрын
Thanks man, great help.
@IroquoisPliskin86
@IroquoisPliskin86 2 жыл бұрын
Whoa, was not expecting sexy voice Brackeys.
@RonSpwan11
@RonSpwan11 5 жыл бұрын
Awesome, thanks!
@14karammv99
@14karammv99 5 жыл бұрын
My only question regarding the comprehension - from the perspective of a true beginner: WHY ARE YOU USING NESTED CLASSES IN A BEGINNERS GUIDE?! COULDN'T IT HAVE BEEN SIMPLIFIED? O'lord.
@abaip9449
@abaip9449 9 жыл бұрын
What happened to the challenges you did in the beginning, I liked those a lot.
@alidore6257
@alidore6257 7 жыл бұрын
The tutorials with challenges were the best I'd ever done. They made me able to make up code myself.
@leluong8743
@leluong8743 6 жыл бұрын
There are plenty on w3resource. Just search for c# challenges for beginner and you'll see it. Cheers
@mandinh18
@mandinh18 3 жыл бұрын
7:34 oh watch out watch out watch out!! Randy Orton out of nowhere!! lol
@Alkhalidi44
@Alkhalidi44 2 жыл бұрын
LMAO
@galeelraglen
@galeelraglen 3 жыл бұрын
Thank you :)
@muramasa7537
@muramasa7537 6 жыл бұрын
So enmuns are used for calling out names which is more useful for us when we have to use a lot of code .
@langningbao3136
@langningbao3136 4 жыл бұрын
When he created a new dog, the Dog hulk part, is that a new type that he created or is it the class that he created?
@deathgoldqwer
@deathgoldqwer 8 жыл бұрын
Whats the Dif between enums and Enums. This video perfectly explains enums but i'm a tad lost to what [E]nums are.
@ernestorojo6333
@ernestorojo6333 8 жыл бұрын
+OP Tildeath they're essentially the same thing, except that enum is the c# type (like saying int or float) and Enum is the .Net class. There are parallels for other types, such as string/String or int/Int32. Typically you'll use the c# type to declare the thing and the .Net type for static class methods. For example: enum Color { Red, Blue }; Color colorValue; Enum.TryParse("Red", out colorValue);
@starinsky2873
@starinsky2873 6 жыл бұрын
I think how can c# used for programming unity it is just loop calculator something like that
@sebastianrasmussen8235
@sebastianrasmussen8235 9 жыл бұрын
so you have been ekstreamly busy with Photoshop? Just joking Nice video!:)
@TheBcoolGuy
@TheBcoolGuy 9 жыл бұрын
If you wanted to create a game with ticks (as they're called in Minecraft) and wanted to bind all motion and animation to these ticks, to then be able to go in backwards ticks, what would you need to do with the loop to get it to work? :) (Like in Braid, sort of)
@kelvindecosta3362
@kelvindecosta3362 9 жыл бұрын
By my understanding you mean to say you want time manipulation ?? All you have to do is make a script that changes the scale of time according to some input .... The editable variable Time.scale (not sure if its .scale or .timescale) can be changed ..... Its default value is 1 ....for slow motion you can change it in the script to 0.5 or anything less than 1 ....I'm not sure about -ve values.... Also if you want to manipulate time in the entire world except your character.....in your player character script use time.unscaleddeltatime..... Hope I helped
@goshinn
@goshinn 6 жыл бұрын
pls don't kill me for this but what's wrong with using strings for breeds? at 7:01 Brackeys mentions that we can make a switch statement and that we have to support all different types of breeds. But couldn't the default case in switch statements account for all the cases we're not bothered by? Then we wouldn't have to "sit there and type in all of them" "easily broken"? does that refer to human errors like typing strings wrongly? We could use the console to see which line produces the errors right? Sorry if I sounded rude, also I'm still new to programming so I apologise if what brackeys is trying to say flew past my head >.> and would appreciate if someone could explain
@94D33M
@94D33M 6 жыл бұрын
I think whats easier is that instead of remembering the breed name or the index, with enums you can now just press . and the list will come up( obviously you have to type in the list at the beginning with enum)
@jamesk7416
@jamesk7416 9 жыл бұрын
Thanks man!
@LunarBulletDev
@LunarBulletDev 5 жыл бұрын
"Chihuahua called hulk" xD 9:06
@ThePeruvian011
@ThePeruvian011 5 жыл бұрын
I had to scroll to far to find this hahha
@chaks2432
@chaks2432 6 жыл бұрын
When I try to run the program it says "Cannot Implicitly convert type String to Project.MainClass.Breed" in "breed = _breed;"
@nicholascarr6251
@nicholascarr6251 6 жыл бұрын
What's happening is that _breed is still a string. So change it to Breed.
@nicholascarr6251
@nicholascarr6251 6 жыл бұрын
He gets the same problem at 9:16
@Kjobbit
@Kjobbit 7 жыл бұрын
I don't understand how using an enum resolved the issue of using a switch statement. It just seems to be a simpler way of typing breed (giving you a multiple choice from a list) but beyond giving you a multiple choice what exactly does an enum do?
@OwenOzone
@OwenOzone 6 жыл бұрын
I felt like I just heard Barney the Dinosaur swear when I heard that cuss! :p
@person1860
@person1860 4 жыл бұрын
For anyone who's new, there's a 3-4 minute video that manages to go more in-depth about enums than this video.
@bigbirdlover759
@bigbirdlover759 2 жыл бұрын
what video?
@person1860
@person1860 2 жыл бұрын
@@bigbirdlover759 at this point 🤷
@bigbirdlover759
@bigbirdlover759 2 жыл бұрын
@@person1860 lol
@w.d-gaster5416
@w.d-gaster5416 4 жыл бұрын
one question, why do you have to create the enum at the Animal class and why you just cant create it at the dog class? i tried it and when i created a dog instance i couldnt set up a breed for it
@codytremblay8986
@codytremblay8986 7 жыл бұрын
i'm still confused what this is.
@AdiHasArrived
@AdiHasArrived 7 жыл бұрын
Ask me what you want to. You can also visit the forums on Brackey's official website and also Unity forums or some other programmer's forums.
@daveb7596
@daveb7596 6 жыл бұрын
lmao first time i think ive ever heard him swear hahahaha love it.
@RobertGolusinski
@RobertGolusinski 7 жыл бұрын
cool explenation, thank you sir
@kelvindecosta3362
@kelvindecosta3362 9 жыл бұрын
Do you have an Asus Brackeys ?
@Layarion
@Layarion 7 жыл бұрын
can i use enums in a Property?
@rowanharley9810
@rowanharley9810 9 жыл бұрын
Can you make another group of tutorials like how to make a survival multiplayer game
@eternalyoungchildrenofthen286
@eternalyoungchildrenofthen286 9 жыл бұрын
what do u recommend to watch after this?
@moizifty
@moizifty 9 жыл бұрын
Wombat Harness rbwhitaker.wikidot.com/c-sharp-tutorials
@fried_broccoli
@fried_broccoli 9 жыл бұрын
Moiz Iftikhar thanks ! it's explanation was very clear :) do you have any other website links ?
@moizifty
@moizifty 9 жыл бұрын
Ali Akbar sure, www.tutorialspoint.com/csharp/
@geldonrashidi4572
@geldonrashidi4572 9 жыл бұрын
What enums are making easier???
@TGEnigma
@TGEnigma 9 жыл бұрын
Only For Games it's like a dictionary of known 'types' with the ability to assign values to them so you it becomes easier to manage the possibly many different types programmatically.
@dannyboyno2
@dannyboyno2 7 жыл бұрын
I am so spectacularly confused by what has been happening since #9 about arrays. This stuff is crazy for beginners. Sigh.
@zakkhan4393
@zakkhan4393 8 жыл бұрын
Why isnt the enum breed inside the derived dog class?
@calabiyou
@calabiyou 9 жыл бұрын
Great.
@nhan1503
@nhan1503 6 жыл бұрын
best!!!!!!!!
@iiplayingmodeii
@iiplayingmodeii 9 жыл бұрын
Please complete CreateAGame Series and thanks
@thek1llerbear654
@thek1llerbear654 5 жыл бұрын
Oh I needed a Pixel Art ToolKit my other pixel art app was a kids coding app (Scratch) until they changed their way of saving sprites to some weird .sprite thing so i can't use its built in Pixel Editor
@huck6453
@huck6453 4 жыл бұрын
I still don't understand it :( I mean... The only reason why enums are useful is this list of values that appears when you write "Breed."? Because i don't see any practical way of using it
@SgtRegg
@SgtRegg 5 жыл бұрын
after reading about and watching videos about enums i still cannot see a difference to simple string-arrays
@verdalyard
@verdalyard 3 жыл бұрын
Can someone explain to me, not a native speaker (I am upper-interm.), why does he say enum as [i:nm], not [i'nju:m], like is must be?
@drv5037
@drv5037 7 жыл бұрын
thx
@theloaten17
@theloaten17 9 жыл бұрын
will you do Java script soon.
@chomychata4350
@chomychata4350 8 жыл бұрын
hye
@Ninjadudeadventures
@Ninjadudeadventures 9 жыл бұрын
I do not know how to code at all and I am making a 2d Platformer with nothing but the Sample Assets that come with Unity 5 but I can not figure out how to make Spawn-point changes I have only what unity provided me and this is in C# can you please make a tutorial of how to do this Please.
@mrmoinn
@mrmoinn 5 жыл бұрын
Did I just hear Brackeys swear!?!?!?
@FlamingSteed
@FlamingSteed 3 жыл бұрын
"...to like ehhh, fuck up so to say! :D"
@Ppstate32
@Ppstate32 9 жыл бұрын
ok so i started programming 2 days ago and i started wwith c#! i downloaded visual studio 2015 and writted a bunch of programs! but now im stuck with a problem! so im trying to write a program that guesses your chosen number! i know it can be done llike this:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { string number; Console.WriteLine("Choose a number!"); number = Console.ReadLine(); Console.WriteLine("Your number is " + number); Console.ReadLine(); } } } but i want to do it with some questions! Like i ask is the number higher than 100? and if they say yes i guess the number! or is the nubmer lower than 100? and if they say yes i guess the number! but i want both of these questions in 1 program! i tried if/else statements but i dont know how since when i use int i need to put a value of the number which i dont know yet since the "player" is going to chose it! can i get some help please???
@kaput8
@kaput8 9 жыл бұрын
zan colja 1) use the number as int not string. U can read int like this : Console.WriteLine("Choose a number!"); int number = Convert.ToInt32(Console.ReadLine()); 2) just make so else if statements. like q&a char answ; //anserw for short Console.WriteLine("question"); Console.ReadLine(asnw); if (asnw == y) { //U do wat u want if he answ yes } else if (answ == n) { //2nd question and shit }
@Ppstate32
@Ppstate32 9 жыл бұрын
yes i figured it out aleready made the program! also have you got any suggestions on a first game/ more advanced program??
@f0cus643
@f0cus643 6 жыл бұрын
Yea make a calculator
@williamsmith6364
@williamsmith6364 6 жыл бұрын
Why no great DANE
@sneeznoodle
@sneeznoodle 4 жыл бұрын
Only in code will you ever hear the phrase "Public dog constructor"
@ZenChibiko
@ZenChibiko 9 жыл бұрын
Hi! Thanks for tutorial ) Cool, but when i sow tutors like this, i can't understand - where it can useful in Unity3D... No one shows examples ingame :D But for enums thanks. And it was so little about cases.
@prestonwallitsch8636
@prestonwallitsch8636 4 жыл бұрын
2:09, is anyone else disturbed at how he wrote East before South.
@rizqyfahmi8343
@rizqyfahmi8343 8 жыл бұрын
It's like array but selected by name? #IMHO
@AnasAhmed-ib1my
@AnasAhmed-ib1my 8 жыл бұрын
its giving error whats wrong usingSystem; namespace Ri { class MainClass { enum Breed {bulldog, chuhuahua}; class Animal { enum Breed {bulldog, chuhuahua}; public string name; public int age; public float happiness; } class Dog : Animal { public Breed breed; public Dog (string _name, int _age, float _happiness, Breed _breed) { name= _name; age= _age; happiness= _happiness; Breed = _breed; } public void Printbase() { Console.WriteLine("Name: " +name); Console.WriteLine ("Age: " + age); Console.WriteLine (" Happiness : " + happiness); Console.WriteLine (" Breed" + Breed); } } public static void Main (string[] args) { Dog Bull = new Dog("Bull", 12, 0.2f, Breed.chuhuahua); Bull.Printbase (); Console.ReadKey(); } } }
@thanasis.malasidis
@thanasis.malasidis 8 жыл бұрын
On the 11th line of your code, you should remove: enum Breed {bulldog, chuhuahua}; You probably get an error because you have alredy declared an enum with the name Breed. Also, for future reference, when you have problems with your code and post it online you should give more information about the error you get.
@delcogoblin
@delcogoblin 4 жыл бұрын
Never thought I'd hear you swear lol
@thotagangireddy8666
@thotagangireddy8666 6 жыл бұрын
but nxopen tutorials please
@kevinmarmet
@kevinmarmet 6 жыл бұрын
My dogs name is Hulk! lol He is a Rott tho
@LIDOGAMES
@LIDOGAMES 2 жыл бұрын
you were slow in old days!
@robertl8429
@robertl8429 6 жыл бұрын
why create the example of north south east west and then delete it? its too confusing. i don't know why online programmers trying to teach people, spend time on an example, something basic, then delete it after 2 minutes. just when im following along with north south east west you switch to DOGS! confusing for beginners honestly.
@BAVy11037
@BAVy11037 6 жыл бұрын
the explanation starts at about 6:50...
13. How to program in C# - PROPERTIES - Beginner Tutorial
18:33
C# Enum [Step By Step Tutorial to use C# Enum] - How to use an Enum in C#
21:52
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 141 МЛН
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 108 МЛН
小路飞还不知道他把路飞给擦没有了 #路飞#海贼王
00:32
路飞与唐舞桐
Рет қаралды 75 МЛН
REAL MAN 🤣💪🏻
00:35
Kan Andrey
Рет қаралды 42 МЛН
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 725 М.
"Hello, World" in 5 CURSED languages that no one should use
13:08
Dreams of Code
Рет қаралды 553 М.
DRM explained - How Netflix prevents you from downloading videos?
18:17
Mehul - Codedamn
Рет қаралды 201 М.
WHAT IS... An Enum? [Unity Tutorial]
8:21
Comp-3 Interactive
Рет қаралды 9 М.
How to program in Godot - GDScript Tutorial
58:10
Brackeys
Рет қаралды 761 М.
How to write "smarter" enums in C#
12:56
Nick Chapsas
Рет қаралды 134 М.
Beginner's Guide to Enums In CSharp - C# Enum Tutorial
7:25
Dev Leader
Рет қаралды 1 М.
Bringing C# enums to the next level!
46:32
Codewrinkles
Рет қаралды 1,7 М.
C# enums 🪐
7:07
Bro Code
Рет қаралды 73 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 141 МЛН