---
title: "Using this in parameters of static methods in static class?"  
description: "Using this in parameters of static methods in static class?"  
author: "Anonymous User"  
published: 2014-01-27  
updated: 2014-01-28  
canonical: https://www.mindstick.com/forum/1888/using-this-in-parameters-of-static-methods-in-static-class  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Using this in parameters of static methods in static class?

Why should I use 'this' in [static](https://www.mindstick.com/articles/12098/the-static-keyword-the-static-methods) [functions](https://www.mindstick.com/forum/160140/explain-the-role-of-functions-as-a-service-faas-in-serverless-computing) of static classes to [objects](https://www.mindstick.com/forum/145447/what-are-objects) in [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp)? I [mean](https://yourviews.mindstick.com/view/80768/what-does-real-minority-mean) is the real [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between using those 2 [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best)?

```
public static class Extensions{    public static string AsJson(this object obj)    public static string AsJson2(object obj)}
```

## Replies

### Reply by Pravesh Singh

Hi Ankit,\

The first one is an extension method, whereas the second one is just a static method.

## The difference is in how you can call them:

```
object myObj = new object();var result = myObj.AsJson();var result2 = Extensions.AsJson2(myobj);
```

Note that you can also use the first one as a simple static method:

var result3 = Extensions.AsJson(myObj);

Essentially, it's just syntactical sugar. Upon compilation, the first statement will be transformed into the last one.


---

Original Source: https://www.mindstick.com/forum/1888/using-this-in-parameters-of-static-methods-in-static-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
