The requested page is not available for the requested platform. You are viewing the content for Default platform.

Introduce Format Item

Purpose

Extracts a part of the formatted string into a format item. This Code Provider is especially useful if you used to construct a string first and then replace its parts with the variables.

Availability

Available when a part of the formatted string is selected.

Usage

  1. Select a part of the formatted string.

  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Introduce Format Item from the menu.

After execution, the Code Provider creates a string.Format call with the selected part extracted into a format item. If the string is already a format string, the selected part will be added as a new format item to the existing composite formatting method.

string debugString = string.Format("a: {0}\tb: 2.34\tc: 3.456;", "1.2");
See Also