Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Snippetica for C#New to Visual Studio Code? Get it now.

Snippetica for C#

Josef Pihrt

|
12,108 installs
| (1) | Free
A collection of snippets for C#.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Snippet Browser

  • Browse all available snippets with Snippet Browser.

Quick Reference

Member Declaration

Shortcut Description Comment
_ interface member declaration prefix
c class declaration -
co constructor declaration -
de delegate declaration -
en enum declaration -
ev event declaration -
f field declaration -
i interface declaration -
in indexer declaration -
k constant declaration -
m method declaration -
p property declaration -
re record declaration -
st struct declaration -

Modifer

Shortcut Description Comment
i internal (Friend) prefix
p private prefix
r read-only prefix (after access modifier)
s static (Shared) prefix (after access modifier)
v virtual (Overridable) prefix (after access modifier)

Statement

Shortcut Description Comment
fe foreach statement -
fr for statement -
if if statement -
sw switch statement -
t try statement -
th throw statement -
u using statement -
w while statement -

Operator

Shortcut Description Comment
cop conditional operator -
n new object creation -
no nameof operator -
oo operator overload -
t explict cast operator -
to typeof operator -
x logical not operator prefix

Type

Shortcut Description Comment
a Array -
b Boolean -
dt DateTime -
i Int32 -
l List<T> -
o Object -
s String -

Other

Shortcut Description Comment
c catch clause -
d default keyword -
e else clause -
f finally clause -
l lambda expression -
n (equals to) null -
pa parameter array -
pp preprocessor directive prefix
ps private set -
r return keyword -
v local variable declaration -
x with initializer suffix
y yield prefix

List of Selected Snippets

Shortcut Title
_ev interface event
_in interface indexer
_m interface method
_p interface property
_rp interface read-only property
a attribute
a_au AttributeUsage attribute
a_c Conditional attribute
a_d Description attribute
a_dd DebuggerDisplay attribute
a_dst DebuggerStepThrough attribute
a_dv DefaultValue attribute
a_f Flags attribute
a_o Obsolete attribute
a_r Required attribute
a_tc TypeConverter attribute
b braces
c public class
catch catch clause
co public constructor
cop conditional operator
copn conditional operator (equal to null)
copxn conditional operator (not equal to null)
d default keyword
da Debug.Assert
de public delegate
dispose dispose pattern
don do while null
doxn do while not null
dt DateTime type
dto DateTimeOffset type
dw Debug.WriteLine
e else clause
eif else-if
en public enum
equals Equals and GetHashCode
f public field
fe foreach statement
finally finally clause
fr for statement
frr for statement (reversed)
i public interface
ifn if equal to null
iftp if TryParse
ifx if not
ifxn if not equal to null
ifxtp if not TryParse
in public indexer
k public const
kvp KeyValuePair type
kvpc KeyValuePair.Create method
l lambda expression
l0 lambda expression without parameters
l2 lambda expression with 2 parameters
m public method
n equal to null
no nameof operator
o object keyword
p public auto property
pa parameter array
ppif #if directive
ppife #if-#else directive
ppr #region directive
pps public auto property with private setter
r return keyword
re public record
ref return false
ren return null
rest public record struct
ret return true
rf public read-only field
rin public read-only indexer
rp public read-only auto property
rpp public read-only property
rrest public readonly record struct
rst public read-only struct
s string keyword
sc public static class
sco static constructor
sf public static field
sh switch statement [Obsolete]
sm public static method
sne string.IsNullOrEmpty
snw string.IsNullOrWhiteSpace
srf public static read-only field
srp public static read-only auto property
srpp public static read-only property
st public struct
sw switch statement
swe switch expression
t explicit cast operator
tc try-catch
tcf try-catch-finally
td TODO comment
tf try-finally
thn throw new
to typeof operator
u using statement
us using static directive
uv using variable
v local variable declaration
va array variable
vb Boolean variable
vi Int32 variable
vm public virtual method
vn - new variable
vp public virtual auto property
vrp public virtual read-only auto property
vrpp public virtual read-only property
vs String variable
vt local variable declaration with explicit cast operator
w while statement
we while statement [Obsolete]
wen while null [Obsolete]
wexn while not null [Obsolete]
where generic type constraint
wn while null
wxn while not null
xn not equal to null
xsne !string.IsNullOrEmpty
xsnw !string.IsNullOrWhiteSpace
yb yield break statement
yr yield return statement

(Generated with DotMarkdown)

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft