Snippet Editor 2.1.0.0 - Function calls

Sep 15, 2009 at 11:04 AM

I was wondering if it is possible to call internal functions from within the code snippet?

I want to try and convert this code snippet.


Private $PrivateVariable$ As $PropertyType$
Public Property $PropertyName$() As $PropertyType$
    Get
        Return $PrivateVariable$ 
    End Get
    Set(ByVal value As $PropertyType$)
        $PrivateVariable$ = value
    End Set
End Property

to....

Private _$PrivateVariable$.ToCamelCase As $PropertyType$ 'includes '_' with lower case initial char
Public Property $PropertyName$.ToPascalCase() As $PropertyType$ 'Upper case initial char
    Get
        Return $PrivateVariable$
    End Get
    Set(ByVal value As $PropertyType$)
        $PrivateVariable$ = value
    End Set
End Property


Can you confirm if is it possible?  I thought about using the function feature but can not find much documentation.

Many thanks,

Dave Wiltshire

Coordinator
Sep 18, 2009 at 6:35 AM
Hi Dave,

Unfortunately you cannot call custom functions from Snippets. Although the
snippet format includes functions, VB doesn't support any functions at all,
and C# only supports a few such as SimpleTypeName, ClassName and
GenerateSwitchCases.
I believe the reason they omitted this functionality was because it opens up
an entire can of security worms for the sharing of snippets. Still, I think
it would be nice if it was there or common functions such as date time,
machine/user info, and casing requests such as yours for a camel cased
backing field with a pascal cased property where catered for with a wider
set of supported built in functions. Sadly that isn't the case today, nor
for VS 2010 that I know of :(
May 8, 2013 at 9:39 AM
I cannot get the ClassName() function to work. It never generates a name. Any ideas why this might be happening. Thanks.