ASP.NET ,equivalent to PHP Print_r Function?

前端 未结 6 1854
忘了有多久
忘了有多久 2021-01-14 17:50

PHP Print_r is useful to print out array and dictionary collection. is asp.net build in this function??

6条回答
  •  逝去的感伤
    2021-01-14 18:36

    No there is no function available in .net as print_r(). But you can use your custom function and print array or IEnumerable items in response. For E.g:

    if (val is IEnumerable)
            {
                var e = val as IEnumerable;
                foreach (var i in e)
                {
                    Response.Write(i.ToString() + "
    "); } }

提交回复
热议问题