Here’s an example of a class in C# that generates a registration random code consisting of uppercase letters and digits, based on a given name, along with an expiration date:

using System;
using System.Text;

public class RegistrationCodeGenerator
{
    private const string Characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    private const int CodeLength = 8;
    private const int ExpirationDays = 7;

    public string GenerateRegistrationCode(string name)
    {
        StringBuilder codeBuilder = new StringBuilder();
        Random random = new Random();

        for (int i = 0; i < CodeLength; i++)
        {
            int index = random.Next(Characters.Length);
            codeBuilder.Append(Characters[index]);
        }

        string code = codeBuilder.ToString();
        DateTime expirationDate = DateTime.Now.AddDays(ExpirationDays);

        Console.WriteLine($"Registration code for {name}: {code}");
        Console.WriteLine($"Expiration date: {expirationDate}");

        return code;
    }
}

You can use the GenerateRegistrationCode method to generate a registration code based on a given name. The method generates a random code by randomly selecting characters from the Characters string and concatenating them together. It also calculates the expiration date by adding the specified number of days to the current date. Finally, it prints the registration code and expiration date to the console.

Here’s an example usage of the class:

RegistrationCodeGenerator generator = new RegistrationCodeGenerator();
string name = "John Doe";
string registrationCode = generator.GenerateRegistrationCode(name);

This will generate a registration code for the name “John Doe” and store it in the registrationCode variable.