Thread: Help on Dictionary copy

  1. #1
    Registered User
    Join Date
    Nov 2011

    Help on Dictionary copy

    // create dictionaries
        public Dictionary<string, int> colors = new Dictionary<string, int>();
        public string color; // name for dictionary
        public Dictionary<string, string> geneo = new Dictionary<string, string>();
        public string gtype; // name for dictionary
     // create unlinked dictionaries
            public Dictionary<string, string> geneo2 = new Dictionary<string, string>(); // Unlinked
            public string gtype2; // name for dictionary
            public Dictionary<string, int> colors2 = new Dictionary<string, int>(); // Unlinked
            public string color2; // name for dictionary
    This is where I run into problems
                // copy dicitionaries
                Dictionary<string, int> colors copy = new Dictionary<string, int>(colors2);
    What is the correct syntax?

  2. #2
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Dictionary<string, int> colorsCopy = new Dictionary<string, int>(colors2);
    colors copy
    is not a valid identifier name.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dictionary
    By nshekofte in forum C# Programming
    Replies: 5
    Last Post: 07-28-2011, 04:40 PM
  2. foreach Dictionary
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-27-2008, 10:01 AM
  3. Dictionary Values copy
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-19-2008, 09:29 AM
  4. Dictionary reference
    By CodeMonkey in forum C++ Programming
    Replies: 4
    Last Post: 11-11-2003, 12:51 AM
  5. May I buy you a dictionary?
    By EvenFlow in forum A Brief History of
    Replies: 24
    Last Post: 10-19-2001, 12:58 PM