Skip to content

Instantly share code, notes, and snippets.

@rezanid
Created July 9, 2025 18:00
Show Gist options
  • Select an option

  • Save rezanid/bf7af68e198a6c161167672f8b411669 to your computer and use it in GitHub Desktop.

Select an option

Save rezanid/bf7af68e198a6c161167672f8b411669 to your computer and use it in GitHub Desktop.
How to get .editorconfig options using Roslyn / Visual Studio SDK
public string GetNamespaceStyle(Document document)
{
var options = await document.GetOptionsAsync(cancellationToken);
var optionKey = new OptionKey(new Option<string>("code_style", "csharp_style_namespace_declarations", "block_scoped"));
return options.GetOption<string>(optionKey);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment