this post was submitted on 04 Jul 2023
12 points (100.0% liked)
.NET
1502 readers
1 users here now
Getting started
Useful resources
IDEs and code editors
- Visual Studio (Windows/Mac)
- Rider (Windows/Mac/Linux)
- Visual Studio Code (Windows/Mac/Linux)
Tools
Rules
- Rule 1: Follow Lemmy rules
- Rule 2: Be excellent to each other, no hostility towards users for any reason
- Rule 3: No spam of tools/companies/advertisements
Related communities
Wikipedia pages
- .NET (open source & cross platform)
- .NET Framework (proprietary & Windows-only)
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
So c# in runtime already knows the type of o(unless you do some silly magic ofcourse) If you wanna change o for debug purposes you can try .GetType() and typeOf
You can check the type with
(Sorry for any errors I'm on phone so code fiddlers aren't that great)
The book uses a very specific scenario where
o
is an object that would accept any type. So using the object data type worked. Check the OP for the edit.