Creating a new Guid inside a code snippet using c#

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2009-07-21T19:55:01Z Indexed on 2010/06/05 23:02 UTC
Read the original article Hit count: 198

Filed under:
|

I want to make an intellisense code snippet using Ctl K + Ctl X that actually executes code when it runs... for example, I would like to do the following:

 <![CDATA[string.Format("{MM/dd/yyyy}", System.DateTime.Now);]]>

But rather than giving me that string value, I want the date in the format specified.

Another example of what I want is to create a new Guid but truncate to the first octet, so I would want to use a create a new Guid using System.Guid.NewGuid(); to give me {798400D6-7CEC-41f9-B6AA-116B926802FE} for example but I want the value: 798400D6 from the code snippet.

I'm open to not using an Intellisense Code Snippet.. I just thought that would be easy.

© Stack Overflow or respective owner

Related posts about c#

Related posts about code-snippets