Answer to Question #332273 in C# for Jen

Question #332273

Write a program that declares a simple structure, declare at least two



variables with different data types and a static method in c#

1
Expert's answer
2022-04-22T04:43:52-0400
using System;

namespace simple_structure
{
    struct Person
    {
        public string name;
        public int age;
 
        public static void Print(string name, int age)
        {
            Console.WriteLine("Name: {0},  Age: {1}", name, age);
        }    
    }
    
    class Program
    {
        public static void Main(string[] args)
        {
            Person.Print("Smit", 23);
            
            Console.Write("/nPress any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS