Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
3.50/5 (4 votes)
See more:
I need to store 2 values in a single variable.
Help me..
Posted

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
 
Share this answer
 
v2
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();
        }
    }
}
 
Share this answer
 
Comments
Bhavna v 28-Mar-11 0:29am    
Helpful sugession
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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900