小编Joh*_*ohn的帖子

c#搜索特定int值的对象数组,然后返回该对象的所有数据

所以我创建了一个包含字符串,整数和浮点数的类.

然后我在这些类型的main中声明了一个数组,并将该类型的对象读入其中

现在我需要搜索该数组以获取特定值,如果该值匹配,则返回整个对象

我该怎么做呢?

真的很难过

public class cdClass
{
    private static string artist = null;
    private static string genre = null;
    private static string cdTitle = null;
    private static float mSRP;
    private static int stock;
    private static int upc = 0;

    //Following functions are public member methods
    public void read_cd(string artist, string genre, string cdTitle, float mSRP, int stock, int upc)
    {
        //cdClass cd = null ;
        System.Console.WriteLine("Enter Artist Name: ");
        artist = Console.ReadLine();

        System.Console.WriteLine("Enter CD Title: ");
        cdTitle = …
Run Code Online (Sandbox Code Playgroud)

c# arrays

6
推荐指数
2
解决办法
4万
查看次数

标签 统计

arrays ×1

c# ×1