---
title: "Setting a variable name as a type"  
description: "Setting a variable name as a type"  
author: "Anonymous User"  
published: 2013-12-23  
updated: 2013-12-23  
canonical: https://www.mindstick.com/forum/1823/setting-a-variable-name-as-a-type  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Setting a variable name as a type

I am deserializing a [json object](https://www.mindstick.com/forum/699/how-to-parse-into-json-object-using-json-parse-in-node-js) from a third [party](https://yourviews.mindstick.com/view/87403/indian-congress-party-secret-relation-with-china) API. One of the [Objects](https://www.mindstick.com/forum/145447/what-are-objects) [properties](https://www.mindstick.com/articles/23331/nootropics-7-different-types-and-their-unique-properties) is a [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation) called "checked". In [c#.net](https://www.mindstick.com/forum/150/how-to-check-a-uploaded-file-type-using-asp-dot-net-with-c-sharp-dot-net) 'checked' is a type. Is there anyway to [overcome](https://www.mindstick.com/articles/12983/remedies-to-overcome-the-hdmi-connection-problems) this.

Im using Newtonsoft [Json.net](https://www.mindstick.com/forum/1903/can-json-dot-net-handle-a-list-lt-object-gt) to do the deserializing.

Nothing special about the [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp),

[public](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) class item{

public bool checked;

}

## Replies

### Reply by Pravesh Singh

Hi John,

While @nemesv's answer is correct and will work fine, I just wanted to mention that there is another alternative if you are using Json.Net. You could use a JsonProperty attribute to map your class property to the JSON property such that they can have different names.

## For example:

```
public class item{   
[JsonProperty("checked")]    public bool IsChecked { get; set; }}
```


---

Original Source: https://www.mindstick.com/forum/1823/setting-a-variable-name-as-a-type

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
