Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can i use a keyword as a propertyname in vb .net?

I have to serialize/deserialize a class into a JSON string/and return. The JSON Strinig must contain the "error" string (like: {error:"something strange occoured", id:23, result:"xxxxx"}), which specifies the occoured error.

How can i implement a class like:

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

like image 819
elCapitano Avatar asked Dec 21 '22 14:12

elCapitano


1 Answers

Surround it with square brackets

Public Class JsonResponse
    Public result As JsonResult
    Public [error] As String
    Public id As Integer
 End Class

HTH

like image 157
Dean Avatar answered Jan 05 '23 14:01

Dean