Click here to Skip to main content
13,048,846 members (69,041 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 12 Jan 2011

Shortcut to generate different property snippets in Visual Studio

, 13 Jan 2011
Rate this:
Please Sign up or sign in to vote.
I ended up adding one for a Lazy Property: propLazy ...
I ended up adding one for a Lazy Property:

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="">
    <CodeSnippet Format="1.0.0">
            <Description>Code snippet for property and lazy backing field</Description>
                    <ToolTip>Property type</ToolTip>
                    <ToolTip>Property name</ToolTip>
            <Code Language="csharp">
                <![CDATA[private System.Lazy<$type$> _$property$ = new System.Lazy<$type$>();
public $type$ $property${ get{ return _$property$.Value; } set{_$property$ = new Lazy<$type$>(() => value);} }

which produces:

private System.Lazy<string> _MyProperty = new System.Lazy<string>();
public string MyProperty { get { return _MyProperty.Value; } set { _MyProperty = new Lazy<string>(() => value); } }


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralReason for my vote of 5 Its a good one! May be in VS 2011 or... Pin
Mahmudul Haque Azad12-Jan-11 15:21
memberMahmudul Haque Azad12-Jan-11 15:21 

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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 14 Jan 2011
Article Copyright 2011 by cechode
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid