使用保留字作为对象

时间:2013-07-12 16:16:39

标签: json vb.net keyword

我需要定义一个名为 end 的对象,因为我从JSON文件中捕获了一些数据:

Imports Microsoft.VisualBasic

Public Class profesionales


Private _idResource As Integer
Private _resourceName As String
Private _start As String
Private _End As DateTime
...

'This should be End buy is a keyword
 Public Property theEnd As DateTime

    Get
        Return _End
    End Get

    Set(ByVal value As DateTime)

        _End = value
    End Set

End Property

JSON文件

[{"idResource":1477,"resourceName":"Juan Llovet Garc\u00EDa","start":"08/07/2013 9:00","end":"08/07/2013 14:00"},{"idResource":1477,"resourceName":"Juan Llovet Garc\u00EDa","start":"08/07/2013 17:00","end":"08/07/2013 20:00"}] 

如何捕捉日期结束

1 个答案:

答案 0 :(得分:3)

您可以使用括号创建与关键字同名的标识符:

public Property [End] As DateTime

这会导致代码混乱,应尽可能避免使用。