[英]can i use a keyword as a propertyname in vb .net?
I have to serialize/deserialize a class into a JSON string/and return.我必须将 class 序列化/反序列化为 JSON 字符串/并返回。 The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.
JSON Strinig 必须包含“错误”字符串(如:{error:“something known occoured”, id:23, result:“xxxxx”}),它指定发生的错误。
How can i implement a class like:我如何实现 class ,例如:
Public Class JsonResponse
Public result As JsonResult
Public error As String
Public id As Integer
End Class
If i do this, the word 'error' is invalid.如果我这样做,“错误”这个词是无效的。
Thanks谢谢
Surround it with square brackets用方括号括起来
Public Class JsonResponse
Public result As JsonResult
Public [error] As String
Public id As Integer
End Class
HTH高温高压
Use [] around the name:在名称周围使用 []:
Public Class JsonResponse
Public result As JsonResult
Public [error] As String
Public id As Integer
End Class
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.