TimeZoneInfo.ToString 方法
定义
返回当前 TimeZoneInfo 对象的显示名称。Returns the current TimeZoneInfo object's display name.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
返回
当前 TimeZoneInfo 对象的 DisplayName 属性值。The value of the DisplayName property of the current TimeZoneInfo object.
注解
在将包含对象的集合分配 TimeZoneInfo 到列表控件(如 ListBox 控件)时,控件将自动调用 ToString 方法以提取描述要在列表中表示的每个对象的字符串。When assigning a collection that contains TimeZoneInfo objects to a list control such as the ListBox control, the control automatically calls the ToString method to extract a string that describes each object to be represented in the list. 因此,不需要将对象的有意义的说明存储为字符串,用户无需使用该字符串从集合中提取对象。As a result, you do not need to store a meaningful description of the object as a string, and the user does not need to use that string to extract the object from the collection. 有关更多详细信息,请参阅 如何:枚举计算机上存在的时区 。See How to: Enumerate Time Zones Present on a Computer for more detail.