andrew4582

ah_ListDataItem.snippet

Mar 5th, 2011
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.47 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.     <CodeSnippet Format="1.0.0">
  4.         <Header>
  5.             <Title>AH List Data Item</Title>
  6.             <Shortcut>ahList_DataItem</Shortcut>
  7.             <Description>Code snippet for creating a ListDataItem class</Description>
  8.             <Author>Andrew Hodgson</Author>
  9.             <SnippetTypes>
  10.                 <SnippetType>Expansion</SnippetType>
  11.             </SnippetTypes>
  12.         </Header>
  13.         <Snippet>
  14.             <Code Language="csharp">
  15.         <![CDATA[
  16.    #region ListDataItem class
  17.        
  18.     public class ListDataItem<KeyType> {
  19.        KeyType _key;
  20.        string _display;
  21.        
  22.        public KeyType Key {
  23.            get {
  24.                return _key;
  25.            }
  26.            set {
  27.                _key = value;
  28.            }
  29.        }
  30.        public string Display {
  31.            get {
  32.                return _display;
  33.            }
  34.            set {
  35.                _display = value;
  36.            }
  37.        }
  38.        public override string ToString() {
  39.            return Display;
  40.        }
  41.        public ListDataItem() {}
  42.        public ListDataItem(KeyType keyValue,string displayValue) {
  43.            Key = keyValue;
  44.            Display = displayValue;
  45.        }
  46.        public ListDataItem(string displayValue) {
  47.            Display = displayValue;
  48.            Key = default(KeyType);
  49.        }
  50.    }
  51.    
  52.    #endregion
  53.    ]]>
  54.             </Code>
  55.         </Snippet>
  56.     </CodeSnippet>
  57. </CodeSnippets>
Advertisement
Add Comment
Please, Sign In to add comment