当前位置: 首页>>代码示例>>C#>>正文


C# Object.toString方法代码示例

本文整理汇总了C#中System.Object.toString方法的典型用法代码示例。如果您正苦于以下问题:C# Object.toString方法的具体用法?C# Object.toString怎么用?C# Object.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Object的用法示例。


在下文中一共展示了Object.toString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: valueOf

 /**
  * Converts the specified object to its string representation. If the object
  * is null return the string {@code "null"}, otherwise use {@code
  * toString()} to get the string representation.
  *
  * @param value
  *            the object.
  * @return the object converted to a string, or the string {@code "null"}.
  */
 public static String valueOf(Object value)
 {
     return value != null ? value.toString() : "null"; //$NON-NLS-1$
 }
开发者ID:gadfly,项目名称:nofs,代码行数:13,代码来源:java.lang.StringJ.cs

示例2: insert

 /**
  * Inserts the string representation of the specified {@code Object} at the
  * specified {@code offset}. The {@code Object} value is converted to a
  * String according to the rule defined by {@link String#valueOf(Object)}.
  *
  * @param offset
  *            the index to insert at.
  * @param obj
  *            the {@code Object} to insert.
  * @return this builder.
  * @throws StringIndexOutOfBoundsException
  *             if {@code offset} is negative or greater than the current
  *             {@code length()}.
  * @see String#valueOf(Object)
  */
 public StringBuilder insert(int offset, Object obj)
 {
     insert0(offset, obj == null ? "null" : obj.toString()); //$NON-NLS-1$
     return this;
 }
开发者ID:gadfly,项目名称:nofs,代码行数:20,代码来源:java.lang.StringBuilder.cs

示例3: append

 /**
  * Appends the string representation of the specified {@code Object}.
  * The {@code Object} value is converted to a string according to the rule
  * defined by {@link String#valueOf(Object)}.
  *
  * @param obj
  *            the {@code Object} to append.
  * @return this builder.
  * @see String#valueOf(Object)
  */
 public StringBuilder append(Object obj)
 {
     if (obj == null) {
         appendNull();
     } else {
         append0(obj.toString());
     }
     return this;
 }
开发者ID:gadfly,项目名称:nofs,代码行数:19,代码来源:java.lang.StringBuilder.cs

示例4: append

 /**
  * Adds the string representation of the specified object to the end of this
  * StringBuffer.
  * <p />
  * If the specified object is {@code null} the string {@code "null"} is
  * appended, otherwise the objects {@code toString} is used to get its
  * string representation.
  *
  * @param obj
  *            the object to append (may be null).
  * @return this StringBuffer.
  * @see String#valueOf(Object)
  */
 public java.lang.StringBuffer append(Object obj)
 {
     lock (this) {
         if (obj == null) {
             appendNull();
         } else {
             append0(obj.toString());
         }
         return this;
     }
 }
开发者ID:sailesh341,项目名称:JavApi,代码行数:24,代码来源:StringBuffer.cs

示例5: convertKey

 //-----------------------------------------------------------------------
 /**
  * Overrides convertKey() from {@link AbstractHashedMap} to convert keys to
  * lower case.
  * <p>
  * Returns null if key is null.
  *
  * @param key  the key convert
  * @return the converted key
  */
 protected override Object convertKey(Object key)
 {
     if (key != null)
     {
         return key.toString().ToLower();
     }
     else
     {
         return AbstractHashedMap.NULL;
     }
 }
开发者ID:gadfly,项目名称:nofs,代码行数:21,代码来源:org.apache.commons.collections.map.CaseInsensitiveMap.cs

示例6: checkNotNullAndLog

 protected static void checkNotNullAndLog(String argName, Object value) {
   Preconditions.checkArgument(value != null && !value.toString().isEmpty(),
     argName + " is null or empty");
   log.debug("{}: {}", argName, value);
 }
开发者ID:yan6pz,项目名称:MovieRecommendation,代码行数:5,代码来源:AbstractJDBCComponent.cs


注:本文中的System.Object.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。