如何在变量中保存2个值 [英] How to save 2 values in a variable

查看:117
本文介绍了如何在变量中保存2个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在一个变量中存储2个值.
帮帮我..

I need to store 2 values in a single variable.
Help me..

推荐答案

请参阅C#关键字structclass,考虑使用 array .首先是值类型,类和数组是引用类型,因此也请参见:http://msdn.microsoft.com/en-us/library/t63sy5hs(v=vs.80).aspx [ ^ ].

该问题远低于询问者期望的能使CodeProject成员有效提供帮助的知识水平.提出其他问题之前,您需要自己学习基础知识.请在这里阅读我的建议:我有问题与我的程序.请帮忙! [
See C# keywords struct and class, consider using array. First is a value type, the class and array are reference types, so also see this: http://msdn.microsoft.com/en-us/library/t63sy5hs(v=vs.80).aspx[^].

This Question is well below the level of knowledge expected from the Inquirer to make help from CodeProject members effective. You need to learn the basics by yourself before asking further Questions. Please read my advices here: I have a problem with my program. Please help![^].

—SA


嘿,我认为这对您有帮助,实际上您的问题尚不清楚,但我想您是在追随:
Hey I think this would help you, actually your question is not clear but i think you are asking follow:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication3
{
    [Flags]
    enum month { jan=1,feb=2,mar=4,apr=8,may=16};
    class Program
    {
        static void Main(string[] args)
        {
            month m = month.jan | month.apr;
            Console.WriteLine("months: "+m);
            for (int i = 1; i < 16; i++)
            {
                Console.WriteLine("{0,3}- {1}",i,((month)i).ToString());
            }
                Console.Read();
        }
    }
}


通过使用键值对使用哈希表或数组列表,可以存储值.或
您可以使用逗号分隔值(CSV)格式存储在字符串中,并且可以通过分隔逗号来轻松获取值.
Use Hash-tables or array-list by using Key value pair you can store the values. or
You can store in string by a Comma Seperated Values(CSV) format and you can fetch the values easily by separating the comma''s.


这篇关于如何在变量中保存2个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆