سؤال

(Might not be the appropriate forum to ask, but..)

Is there a way to add a custom code snippet as in Xcode. In Xamarin, ToolBox section, I found the prebuilt code snippets. But if I had to add a new one, its asking for the Assembly.

In Xcode, its like we can select the code and drag onto the codesnippets pane to add it as one.

Any info regarding the same in Xamarin would be most helpful.

Thanks!

هل كانت مفيدة؟

المحلول

In Xamarin Studio open the settings menu:

  • Windows: Tools > Options
  • OS X: Xamarin Studio > Preferences

Navigate To Text Editor -> Code Templates

Here you can edit snippets that come with Xamarin studio as well as add new ones. For syntax I'd recommend just looking at one of the already present properties.

E.g. default property looks like this:

public $type$ $name$ {
    get;
    set;
}

You could change that to have a backing store:

private $type$ _$name$;
public $type$ $name$ {
    get { return _$name$; } 
    set { _$name$ = value; }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top