小编Dee*_*kur的帖子

将字符串转换为时间跨度

我需要在 C# 中将我的字符串转换为时间跨度,这是我的字符串52:13:27.0000000 当我尝试 Timespan.parse 时,它​​给出了错误

无法解析 TimeSpan,因为至少有一个数字组件超出范围或包含太多数字。

请帮忙!谢谢

c#

4
推荐指数
1
解决办法
5170
查看次数

在html中的输入字段上设置并获取自定义属性

我必须为每个输入字段设置自定义属性.我的意见如下.我可以设置这样的属性吗?

<input typeid='1' type='checkbox' class='chk' id='inp1' />
<input typeid='1' type='checkbox' class='chk' id='inp1' />
<input typeid='1' type='checkbox' class='chk' id='inp1' />
<input typeid='2' type='checkbox' class='chk' id='inp1' />
<input typeid='2' type='checkbox' class='chk' id='inp1' />
<input typeid='3' type='checkbox' class='chk' id='inp1' />
Run Code Online (Sandbox Code Playgroud)

这里,typeid是我的自定义属性.现在我想访问typeid = 1的输入.我该怎么做呢?

html jquery

1
推荐指数
1
解决办法
2441
查看次数

从c#中的json中删除最后一个逗号?

我怎么能从我的json中获取逗号:我将此作为输出json

{Floor_Id:"1094",Booth_Count:12},{Floor_Id:"1095",Booth_Count:10},
Run Code Online (Sandbox Code Playgroud)

这是我的C#代码:

StringBuilder json_result = new StringBuilder();
List<XElement> industries = ExpoHallXML.Descendants("industry").ToList();
                if (industries != null && industries.Count > 0)
                {
                    foreach (XElement industry in industries)
                    {
                        foreach (XElement floor in industry.Descendants("floor"))
                        {
                            if (floor.Attribute("id").Value != "0")
                            {
                                json_result.Append("{");
                                json_result.Append("Floor_Id:" + cmh.json_str(floor.Attribute("id").Value) + ",");
                                int booth_count = 0;
                                foreach (XElement page in floor.Descendants("page"))
                                {
                                    booth_count = page.Descendants("booth").Count();
                                    json_result.Append("Booth_Count:" + booth_count +"},");
                                }

                            }

                        }

                    }
                }
            return json_result.ToString();
Run Code Online (Sandbox Code Playgroud)

请帮忙!谢谢

c#

1
推荐指数
1
解决办法
667
查看次数

日期字符串到月份格式

我想将我的日期字符串转换为MonthDate格式

日期字符串的格式为"08-07-2016 00:00:00"

我需要这个输出:7月8日

我正在尝试,String.Format("{0:ddd, MMM d, yyyy}", dt)但它无法正常工作.

c#

1
推荐指数
1
解决办法
42
查看次数

标签 统计

c# ×3

html ×1

jquery ×1