C#C
C#9mo ago
Faker

✅ namespace and using keyword in C#

Hello guys, I have a quick question. I don't understand, when do we use the using keyword and the namespace keyword... can they be used interchangeably ? (don't remember if I once saw a namespace along with a library name... is that even allowed?) .

Now, the namespace, sometimes I saw something like that: namespace {...}like we have the curly braces but sometimes we don't. My IDE always do the heavy lifting but I wanted to understand what the syntax is :c.

Do we use the keyword using when we need to use certain libraries? While the keyword namespace is used to related to certain folders/cs files? I'm a bit confused here :c... what about the namespace {...} syntax please

C#
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore.Diagnostics;

namespace MainProject.Context;
Was this page helpful?