DEV Community

jalpesh Vadgama
jalpesh Vadgama

Posted on • Edited on

C# 9.0 Feature - Top Level Statements

With .NET 5.0, Microsoft has released new version of C# and It got some cool new features. So I'm creating a video series about those new features and this is video is first of them. In this video, We are going learn about C# 9.0 Top Level Statement feature. With this feature now you don't need to write the boilerplate code like classes and you can directly write your statement and functions.

In this video, I have created an simple console application and explained how we can use the C# 9.0 top level statements. You can even use the functions and few other C# features with top levels statements

But there are certain limitations also there.

  • You can use top level statement in only one file in your visual studio project.
  • You can not combine main method and top level statement together otherwise it will give errors.

For more details please do watch my video.

Here is a complete list of video series:

Part 1: C# 9.0 Feature - Top New Level Statement
http://bit.ly/CS9TopLevelStatement​

Part 2: C# 9.0 Feature - Omit New Expression
http://bit.ly/CS9OmitNewExpression

If you like this video and wanted to see a similar kind of video then, please subscribe to my you tube channel at - https://bit.ly/codewithjv.

Also, Please comment about what content you want to see in my YouTube channel.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more