sitestudio / otest

Test SKGithubTest app
MIT License
0 stars 0 forks source link

StudentPub #217

Open sitestudio opened 1 month ago

sitestudio commented 1 month ago

Provide example of calling a method in the STUDENTPUB App Catalog in C#

skgithubtest[bot] commented 1 month ago
#!/bin/bash

# Create a directory for the STUDENTPUB App Catalog example
mkdir -p STUDENTPUB_App_Catalog

# Create a C# file for the example method call
cat << 'EOF' > STUDENTPUB_App_Catalog/StudentPubExample.cs
using System;

namespace StudentPubApp
{
    public class Student
    {
        public string Name { get; set; }
        public int Age { get; set; }

        // Method to display student information
        public void DisplayInfo()
        {
            Console.WriteLine($"Name: {Name}, Age: {Age}");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            // Create an instance of Student
            Student student = new Student();
            student.Name = "John Doe"; // Assign name
            student.Age = 20;          // Assign age

            // Call the method to display student information
            student.DisplayInfo(); // Output: Name: John Doe, Age: 20
        }
    }
}
EOF

# Create a README file for documentation
cat << 'EOF' > STUDENTPUB_App_Catalog/README.md
# STUDENTPUB App Catalog Example

This C# example demonstrates how to call a method in the STUDENTPUB application. It includes a `Student` class with properties for `Name` and `Age`, and a method to display this information.

## How to Run

1. Compile the C# code using a C# compiler.
2. Run the generated executable to see the output.
EOF