Using keyword as identifier and avoid conflicts - CSharp Language Basics

CSharp examples for Language Basics:Hello World

Introduction

To use an identifier that clashes with a reserved keyword, qualify it with the @ prefix.

class class  {...}      // Illegal
class @class {...}      // Legal

The @ symbol doesn't form part of the identifier itself.

So @myVariable is the same as myVariable.

The @ prefix can be useful when consuming libraries written in other .NET languages that have different keywords.


Related Tutorials