Click here to Skip to main content
15,889,335 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help access image from the internet Pin
Dave Kreskowiak13-May-09 9:38
mveDave Kreskowiak13-May-09 9:38 
GeneralRe: Help access image from the internet Pin
Alex_xso14-May-09 8:21
Alex_xso14-May-09 8:21 
GeneralRe: Help access image from the internet Pin
Dave Kreskowiak14-May-09 17:51
mveDave Kreskowiak14-May-09 17:51 
QuestionHow does one have mdichildren forms automatically sized to fit the parent form? Pin
Lecutus113-May-09 9:06
Lecutus113-May-09 9:06 
AnswerRe: How does one have mdichildren forms automatically sized to fit the parent form? Pin
DaveyM6913-May-09 10:55
professionalDaveyM6913-May-09 10:55 
GeneralRe: How does one have mdichildren forms automatically sized to fit the parent form? Pin
Lecutus114-May-09 8:41
Lecutus114-May-09 8:41 
GeneralRe: How does one have mdichildren forms automatically sized to fit the parent form? Pin
DaveyM6915-May-09 4:38
professionalDaveyM6915-May-09 4:38 
QuestionSortedList, Key as element of Value Pin
Aaron Hartley13-May-09 8:37
Aaron Hartley13-May-09 8:37 
Let's say that you have a SortedList with the Key as a string and the Value as a struct. Also, the string Key is one of the data elements in the struct. Example:
using System;
using System.Collections.Generic;

namespace SortedListStructure
{
    public struct Product
    {
        public string model;
        public string description;
        public int weight;
        public int height;
        public int width;
        public int length;
    };

    class Program
    {
        static void Main(string[] args)
        {
            SortedList<string, Product> sl = new SortedList<string, Product>();
            Product test;
            test.model = "1X-3PA2Q94";
            test.description = "Tractor Motor Sensor";
            test.weight = 3;
            test.height = 3;
            test.width = 3;
            test.length = 3;

            sl.Add(test.model, test);

            string m = test.model;
            if (sl.ContainsKey(m))
            {
                Console.WriteLine("Description: {0}, Weight: {1}", sl[m].description, sl[m].weight);
            }
            else
            {
                Console.WriteLine("{0} not found", m);
            }

            Console.ReadLine();
        }
    }
}

While this works, the model is stored twice (I think? Is it?), once for the Key and once as one of the elements of the Product Value. One way to eliminate this redundancy would be to leave model out of the Product struct, but assume that this is not preferable. What is the most efficient approach when the Key is part of the Value?
AnswerRe: SortedList, Key as element of Value Pin
OriginalGriff13-May-09 8:51
mveOriginalGriff13-May-09 8:51 
GeneralRe: SortedList, Key as element of Value Pin
Aaron Hartley13-May-09 9:40
Aaron Hartley13-May-09 9:40 
GeneralRe: SortedList, Key as element of Value Pin
OriginalGriff13-May-09 9:49
mveOriginalGriff13-May-09 9:49 
AnswerRe: SortedList, Key as element of Value Pin
Luc Pattyn13-May-09 9:24
sitebuilderLuc Pattyn13-May-09 9:24 
GeneralRe: SortedList, Key as element of Value Pin
Aaron Hartley13-May-09 9:46
Aaron Hartley13-May-09 9:46 
GeneralRe: SortedList, Key as element of Value Pin
OriginalGriff13-May-09 9:51
mveOriginalGriff13-May-09 9:51 
AnswerRe: SortedList, Key as element of Value Pin
Kythen13-May-09 9:31
Kythen13-May-09 9:31 
QuestionC# Console Application Pin
bigjoe11a13-May-09 7:49
bigjoe11a13-May-09 7:49 
AnswerRe: C# Console Application Pin
Jimmanuel13-May-09 8:10
Jimmanuel13-May-09 8:10 
GeneralRe: C# Console Application Pin
bigjoe11a13-May-09 8:17
bigjoe11a13-May-09 8:17 
GeneralRe: C# Console Application Pin
Jimmanuel13-May-09 8:38
Jimmanuel13-May-09 8:38 
GeneralRe: C# Console Application Pin
bigjoe11a13-May-09 10:00
bigjoe11a13-May-09 10:00 
GeneralRe: C# Console Application Pin
Jimmanuel13-May-09 11:33
Jimmanuel13-May-09 11:33 
GeneralRe: C# Console Application Pin
OriginalGriff13-May-09 8:43
mveOriginalGriff13-May-09 8:43 
GeneralRe: C# Console Application Pin
bigjoe11a13-May-09 10:26
bigjoe11a13-May-09 10:26 
GeneralRe: C# Console Application Pin
OriginalGriff13-May-09 22:24
mveOriginalGriff13-May-09 22:24 
GeneralRe: C# Console Application Pin
bigjoe11a14-May-09 4:12
bigjoe11a14-May-09 4:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.