﻿<?xml version="1.0" encoding="utf-8"?><Type Name="ICustomFormatter" FullName="System.ICustomFormatter"><TypeSignature Maintainer="auto" Language="C#" Value="public interface ICustomFormatter" /><TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract ICustomFormatter" /><AssemblyInfo><AssemblyName>mscorlib</AssemblyName><AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement><Interfaces /><Attributes><Attribute><AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName></Attribute></Attributes><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The <see cref="T:System.ICustomFormatter" /> interface includes a single method, <see cref="M:System.ICustomFormatter.Format(System.String,System.Object,System.IFormatProvider)" />. When this interface is implemented by a reference or value type, the <see cref="M:System.ICustomFormatter.Format(System.String,System.Object,System.IFormatProvider)" /> method returns a custom-formatted string representation of an object's value. </para><para>Typically, the <see cref="T:System.ICustomFormatter" /> interface is implemented with the <see cref="T:System.IFormatProvider" /> interface to customize the behavior of two .NET Framework composite string formatting methods that include an <see cref="T:System.IFormatProvider" /> parameter. Specifically, the <see cref="T:System.ICustomFormatter" /> interface can provide custom formatting of the value of an object passed to the <see cref="M:System.String.Format(System.IFormatProvider,System.String,System.Object[])" /> and <see cref="M:System.Text.StringBuilder.AppendFormat(System.IFormatProvider,System.String,System.Object[])" /> methods.</para><para>Providing a custom representation of an object's value requires that you do the following:</para><list type="ordered"><item><para>Define a class that implements the <see cref="T:System.ICustomFormatter" /> interface and its single member, the <see cref="M:System.ICustomFormatter.Format(System.String,System.Object,System.IFormatProvider)" /> method.</para></item><item><para>Define a class that implements the <see cref="T:System.IFormatProvider" /> interface and its single member, the <see cref="M:System.IFormatProvider.GetFormat(System.Type)" /> method. The <see cref="M:System.IFormatProvider.GetFormat(System.Type)" /> method returns an instance of your <see cref="T:System.ICustomFormatter" /> implementation. Often, a single class implements both <see cref="T:System.ICustomFormatter" /> and <see cref="T:System.IFormatProvider" />. In that case, the class's GetFormat implementation just returns an instance of itself.</para></item><item><para>Pass the <see cref="T:System.IFormatProvider" /> implementation as the <paramref name="provider" /> argument of the <see cref="M:System.String.Format(System.IFormatProvider,System.String,System.Object[])" /> method or a comparable method. </para></item></list><para>The .NET Framework method will then use your custom formatting instead of its own.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Defines a method that supports custom formatting of the value of an object.</para></summary></Docs><Members><Member MemberName="Format"><MemberSignature Language="C#" Value="public string Format (string format, object arg, IFormatProvider formatProvider);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance string Format(string format, object arg, class System.IFormatProvider formatProvider) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>1.0.5000.0</AssemblyVersion><AssemblyVersion>2.0.0.0</AssemblyVersion><AssemblyVersion>4.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.String</ReturnType></ReturnValue><Parameters><Parameter Name="format" Type="System.String" /><Parameter Name="arg" Type="System.Object" /><Parameter Name="formatProvider" Type="System.IFormatProvider" /></Parameters><Docs><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para><see cref="M:System.ICustomFormatter.Format(System.String,System.Object,System.IFormatProvider)" /> is a callback method. It is called by a method that supports custom formatting, such as <see cref="M:System.String.Format(System.IFormatProvider,System.String,System.Object[])" /> or <see cref="M:System.Text.StringBuilder.AppendFormat(System.IFormatProvider,System.String,System.Object[])" />. The implementation is called once for each format item in a <format type="text/html"><a href="87b7d528-73f6-43c6-b71a-f23043039a49">composite format string</a></format>. For example, in the following statement, the <see cref="M:System.ICustomFormatter.Format(System.String,System.Object,System.IFormatProvider)" /> method is called three times.</para><para>code reference: System.ICustomFormatter.Class#4</para><para>The <paramref name="arg" /> parameter is the object in the object list whose zero-based position corresponds to the index of a particular format item. </para><para>The <paramref name="format" /> parameter contains a format string, which is the <paramref name="formatString" /> component of a format item. If the format item has no <paramref name="formatString" /> component, the value of <paramref name="format" /> is null. If <paramref name="format" /> is null, depending on the type of <paramref name="arg" />, you may be able to use the default format specification of your choice. </para><para>The <paramref name="formatProvider" /> parameter is the <see cref="T:System.IFormatProvider" /> implementation that provides formatting for <paramref name="arg" />. Typically, it is an instance of your <see cref="T:System.ICustomFormatter" /> implementation. If <paramref name="formatProvider" /> is null, ignore that parameter.</para><para>Your implementation of the <see cref="M:System.ICustomFormatter.Format(System.String,System.Object,System.IFormatProvider)" /> method must include the following functionality so the .NET Framework can provide formatting you do not support. If your format method does not support a format, determine whether the object being formatted implements the <see cref="T:System.IFormattable" /> interface. If it does, invoke the <see cref="M:System.IFormattable.ToString(System.String,System.IFormatProvider)" /> method of that interface. Otherwise, invoke the default <see cref="M:System.Object.ToString" /> method of the underlying object. The following code illustrates this pattern.</para><para>code reference: System.ICustomFormatter.Class#3</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Converts the value of a specified object to an equivalent string representation using specified format and culture-specific formatting information.</para></summary><returns><attribution license="cc4" from="Microsoft" modified="false" /><para>The string representation of the value of <paramref name="arg" />, formatted as specified by <paramref name="format" /> and <paramref name="formatProvider" />.</para></returns><param name="format"><attribution license="cc4" from="Microsoft" modified="false" />A format string containing formatting specifications. </param><param name="arg"><attribution license="cc4" from="Microsoft" modified="false" />An object to format. </param><param name="formatProvider"><attribution license="cc4" from="Microsoft" modified="false" />An object that supplies format information about the current instance. </param></Docs></Member></Members></Type>