Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how do i check if the guid for the selected item is present in a list of guids?


[Added from OP "solution" post]

i have an expander with several tabs amd those tabs have similar items. when u drag and drop these items from the tab to a canvas each creates a guid and these guids gets saved into guid lists. each tab has a list for itself. example i drag n drop and object from tab 1 the guid for the item gets saved into the tab1 list n if its from the second tab guid gets saved into tab 2 list n so on. what i need to do now is when i select an item on the canvas i need a window to show the name of the tab it came from
Posted
Updated 28-May-15 20:12pm
v4
Comments
Sergey Alexandrovich Kryukov 29-May-15 2:01am    
What's the problem? What have you tried so far?
And I'm just curious: why some items have GUIDs and why checking them? I'm asking because there many cases of abusing them, or using without right purpose.
—SA
Member 11521909 29-May-15 2:09am    
i have an expander with several tabs amd those tabs have similar items. when u drag and drop these items from the tab to a canvas each creates a guid and these guids gets saved into guid lists. each tab has a list for itself. example i drag n drop and object from tab 1 the guid for the item gets saved into the tab1 list n if its from the second tab guid gets saved into tab 2 list n so on. what i need to do now is when i select an item on the canvas i need a window to show the name of the tab it came from
OriginalGriff 29-May-15 2:14am    
Don't post extra info as a solution: it removes the question from the "unanswered" list. Used the "Improve question" widget instead.
I moved it for you.

1 solution

There is a Contains method which works with any class:List<T>.Contains[^]
Since Guid is a Value type, it will work with the default comparer.
C#
if (my list.Contains(guidToLookFor))
   {
   ...
 
Share this answer
 

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