home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / InfoPath.en-us / InfLR.cab / FL_CTypeOperators_snippet_142747_ENU____.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Extensible Markup Language  |  2008-06-12  |  2KB  |  48 lines

  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>Define a CType Operator</Title>
  6.       <Author>Microsoft Corporation</Author>
  7.       <Description>Defines the CType Operators on a class.</Description>
  8.       <Keywords>
  9.         <Keyword>overloading operators</Keyword>
  10.         <Keyword>CType</Keyword>
  11.         <Keyword>DirectCast</Keyword>
  12.         <Keyword>conversion operators</Keyword>
  13.         <Keyword>narrowing</Keyword>
  14.         <Keyword>Operator keyword</Keyword>
  15.       </Keywords>
  16.       <Shortcut>OpCType</Shortcut>
  17.     </Header>
  18.     <Snippet>
  19.       <Declarations>
  20.         <Literal>
  21.           <ID>DataType</ID>
  22.           <Type />
  23.           <ToolTip>Replace with the type of the data you want to convert to your custom class.</ToolTip>
  24.           <Default>String</Default>
  25.         </Literal>
  26.         <Literal>
  27.           <ID>ClassName</ID>
  28.           <Type />
  29.           <ToolTip>Replace with the name of the class you are implementing.</ToolTip>
  30.           <Default>MyClass</Default>
  31.         </Literal>
  32.         <Literal>
  33.           <ID>ReturnValue</ID>
  34.           <Type />
  35.           <ToolTip>Replace with the return value.</ToolTip>
  36.           <Default>"Replace Me"</Default>
  37.         </Literal>
  38.       </Declarations>
  39.       <Code Language="VB" Kind="type decl"><![CDATA[Public Shared Narrowing Operator CType(ByVal initialData As $DataType$) As $ClassName$
  40.           Return New $ClassName$()
  41.         End Operator
  42.         
  43.         Public Shared Widening Operator CType(ByVal initialData As $ClassName$) As $DataType$
  44.           Return $ReturnValue$
  45.         End Operator]]></Code>
  46.     </Snippet>
  47.   </CodeSnippet>
  48. </CodeSnippets>