Greetings to all.

I'm using visual C# express, just starting to learn C#. I want to build a reminder system for a console App, how do I go about it?

I want to be able to check the DateTime and for each different date read the string attached to it.

You could try create a window form application but you should start browse some google resource to get started.

Console.WriteLine("date in string is: " + DateTime.Now.ToString("dd/MM"));

string[,] date = new string[,]
    {
        {"30/5", "yesterday"},
        {"31/5", "today"},
        {"1/6", "next day"},
        {"2/6", "day after"},
        {"3/6", "another day"}
    };

If I were to use a 2D array as indicated how could i search through the array to find a string aka the first part of the array and display the second part of the array in the console. Exact code would be appreciated as i'm still a noob to C#. This is my first day learning

foreach (string s in date)
            {
                string t = s; // during first loop, t = 30/5

            }

removed linked.. it will only confuse you.. apologies

You might want to try a simpler collection for such usage:

System.Collections.Specialized.StringDictionary s = new System.Collections.Specialized.StringDictionary();
s.Add("string key", "string value"); // here you add your items

s.ContainsKey("string key"); // OR
s.ContainsValue("string value");

p.s. key must be unique... that means if you have a 30/5 in collection already, you are not allowed to insert another key 30/5 as it will trigger an exception. This is great for searching - simply use s.containskey or containsvalue

jfarrugia I like your solution. now if I wanted to find the value attached to the key that I found with s.ContainsKey("string key"); how do I do that? Then I want to write that to the console using Console.WriteLine

if (s.ContainsKey("my key"))
            {
                Console.WriteLine(s["my key"].ToString());
            }

its important to use the ContainsKey method in order to ensure that the key exists. If you attempt to write a non existent value to console, a null exception will be fired.

Brilliant! Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.