c# - Output class instance variables -


So I'm learning how examples work and how to set them up and I'm thinking like this Is that what I do without an example to separate them for output

Ex //

  class program {static zero main (string [] args) {person ryan = new person (); Ryan.ge = 16; Ryan Name = "Rinoh 97"; }} Class person {public full age = 0; Public string name = ""; }   

Now I need a console to produce my age. WrightLine (Ryan.Age); And for my name, I need Ryan.Name but there is a way to output them without making them complicated at the same time.

I have tried Ryan.ToString () but I get its position for class

Any advice?

You can override toString in the individual category and you can output it, but when you do it When you call, you want it.

Here's an example:



Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -