using System; namespace MyFirstProgram { class Program { static void Main(string[] args) { Car[] garage = { new Car("Mustang"), new Car("Corvette"), new Car("Lambo") }; foreach (Car car in garage) { Console.WriteLine(car.model); } Console.ReadKey(); } } class Car { public String model; public Car(String model) { this.model = model; } } }
@ValoranVale3 жыл бұрын
Thank you. It's surprisingly difficult to find concise, well explained information about something that has been around for so long.
@sarccacious4 ай бұрын
Im looking to do a deck of cards. I assume instead of Car you would use Card, and instead of garage you would use Deck. My question is how do i get an int and a string per object and fit them in an array. Lastly, how do I shuffle them?
@spartanranger3 жыл бұрын
Thanks for the video Bro.
@budderrar57512 жыл бұрын
noice
@stefanlazov28882 жыл бұрын
хайст
@neuronerd52112 жыл бұрын
I'll just hand you my tuition....:)
@DetCoAnimeFan3 жыл бұрын
Bro code delivering quality content on C#, I would love this to go upto GUI. BTW I wanted your opinion, how much do you think C# is similar to java and which is better?
@aditya_asundi3 жыл бұрын
yes. c# is very much similar to java. but i don't think you can compare c# with java. it's like asking whether you like a saw or a screwdriver. c# and java may be similar in syntax but are used for different purposes. c# is mostly used to make gui apps and 3d/2d games. java is used in web backend and in android development, and jetbrains makes its ide's with java.
@DetCoAnimeFan3 жыл бұрын
@@aditya_asundi Ohh, well I am learning swing and fx in java. I want to use C# for game development. Thanks for recommendation.
@engirckt54103 жыл бұрын
@@DetCoAnimeFan after c# i wanna learn java, i wanna mod minecraft :D
@DetCoAnimeFan3 жыл бұрын
@@engirckt5410 Java is very similar to java, I have learnt almost the entire playlist of his
@DetCoAnimeFan3 жыл бұрын
@MToiletTerrorist I want to do both game development and app development.
@Proviper6662 жыл бұрын
#Car
@triton54572 жыл бұрын
bro is pro
@janisvirsnitis8312 Жыл бұрын
:)
@LucParent9053 жыл бұрын
Thanks
@sajid_inamdar36922 жыл бұрын
How many objects are being created ? Is it 1 or 3?
@MoHaTa-u3f2 ай бұрын
So basically an array of objects is like a normal array, but instead of listing the datatype (String), you list the object class (Car)
@forward82043 жыл бұрын
and what if i want to create an array with unlimited space? thats i just push numbers into him
@derpyherpy3773 Жыл бұрын
seconding this, anyone found a solution to that?
@salar1997 Жыл бұрын
@@derpyherpy3773 class Program { static void Main(string[] args) { List cars = new List(); cars.Add(new Car("Mustang")); cars.Add(new Car("Mustang")); cars.Add(new Car("Mustang")); cars.Add(new Car("Mustang")); foreach (var car in cars) { Console.WriteLine(car.Model); } } class Car { public string Model { get; } public Car(string model) { this.Model = model; } } }