Click here to Skip to main content
15,887,812 members
Home / Discussions / C#
   

C#

 
AnswerRe: Block webbrowser from accessing webpages in C# Pin
Dave Kreskowiak21-Aug-13 4:19
mveDave Kreskowiak21-Aug-13 4:19 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Oscar Andersson21-Aug-13 20:48
Oscar Andersson21-Aug-13 20:48 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Eddy Vluggen22-Aug-13 5:13
professionalEddy Vluggen22-Aug-13 5:13 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Oscar Andersson22-Aug-13 20:43
Oscar Andersson22-Aug-13 20:43 
GeneralRe: Block webbrowser from accessing webpages in C# Pin
Dave Kreskowiak22-Aug-13 6:21
mveDave Kreskowiak22-Aug-13 6:21 
AnswerRe: Block webbrowser from accessing webpages in C# Pin
Bernhard Hiller21-Aug-13 21:55
Bernhard Hiller21-Aug-13 21:55 
QuestionBluetooth Pairing Problem Win8 Pin
LearnTheCoding20-Aug-13 20:50
LearnTheCoding20-Aug-13 20:50 
QuestionCollection with unique key by property Pin
Elfin Darkglow20-Aug-13 17:51
Elfin Darkglow20-Aug-13 17:51 
Hi, all.
First, sorry for my poor english.
Problem need a collection with elements, one of the properties must be unique.
Like this
public class Pet
{
   public string Name {get; set;}
   public int Age {get; set;}
}

public class Pets: Collection<Pet>
{ ... 

public Pet this[string name]
        {
            get { return LookupPetByName(name); }
            set
            {
                if (HavePetWithName(name))
                    throw new DublicateNameException(name);
                SetPet(name, value);
            }
        }
...}

This work fine when I use indexer. But I need throw exeption, when I got object by index and change his name.
Pets.Add(new Pet("Ares", 3);
Pets.Add(new Pet("Mike", 6);

var myPet = Pets["Ares"];
myPet.Age = 3;
myPet.Name = "Mike"; // throw DublicateNameException;


Can you suggest me where to dig? Confused | :confused:

Thanks.
AnswerRe: Collection with unique key by property Pin
BillWoodruff20-Aug-13 19:14
professionalBillWoodruff20-Aug-13 19:14 
AnswerRe: Collection with unique key by property Pin
Bernhard Hiller20-Aug-13 21:12
Bernhard Hiller20-Aug-13 21:12 
QuestionHow To Add Buttons In Textbox? Pin
gaofq20-Aug-13 16:03
gaofq20-Aug-13 16:03 
AnswerRe: How To Add Buttons In Textbox? Pin
BillWoodruff20-Aug-13 18:13
professionalBillWoodruff20-Aug-13 18:13 
GeneralRe: How To Add Buttons In Textbox? Pin
gaofq21-Aug-13 4:43
gaofq21-Aug-13 4:43 
GeneralRe: How To Add Buttons In Textbox? Pin
Ravi Bhavnani21-Aug-13 7:38
professionalRavi Bhavnani21-Aug-13 7:38 
GeneralRe: How To Add Buttons In Textbox? Pin
BillWoodruff21-Aug-13 11:31
professionalBillWoodruff21-Aug-13 11:31 
GeneralRe: How To Add Buttons In Textbox? Pin
Ravi Bhavnani21-Aug-13 11:37
professionalRavi Bhavnani21-Aug-13 11:37 
GeneralRe: How To Add Buttons In Textbox? Pin
Mycroft Holmes21-Aug-13 12:53
professionalMycroft Holmes21-Aug-13 12:53 
QuestionTreeview node folder images Pin
rfresh20-Aug-13 13:28
rfresh20-Aug-13 13:28 
AnswerRe: Treeview node folder images Pin
BillWoodruff20-Aug-13 14:57
professionalBillWoodruff20-Aug-13 14:57 
GeneralRe: Treeview node folder images Pin
rfresh20-Aug-13 15:03
rfresh20-Aug-13 15:03 
GeneralRe: Treeview node folder images Pin
BillWoodruff20-Aug-13 15:13
professionalBillWoodruff20-Aug-13 15:13 
GeneralRe: Treeview node folder images Pin
rfresh20-Aug-13 18:09
rfresh20-Aug-13 18:09 
GeneralRe: Treeview node folder images Pin
BillWoodruff21-Aug-13 2:01
professionalBillWoodruff21-Aug-13 2:01 
AnswerRe: Treeview node folder images Pin
Ravi Bhavnani21-Aug-13 7:40
professionalRavi Bhavnani21-Aug-13 7:40 
AnswerRe: Treeview node folder images Pin
SaqibRasheed23-Aug-13 2:19
SaqibRasheed23-Aug-13 2:19 

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.