Background In this post we will cover the Null-Conditional Operator ( ?. ). Series Here are other posts that covers .Net Operators:- .Net:- Operator – The null-coalescing operator ?? Date Published:- 2022-November-8th Link Code Code - HelloWorld Code - HelloWorld Outline Get String Length Print String and String Length Output Output - Text … Continue reading .Net:- Operator – The null-conditional operator ?.
Background Object Oriented Programming Languages allow various features to add additionally functionality to existing classes. Tooling Here are some of the available faculties:- Inheritance Interfaces Base Class String Class Methods Depending on the programming object certain methods may be exposed. Methods such as:- Length Upper Lower Split Word Count Proper Case Reverse Convert … Continue reading .Net:- Extension Methods in C#
Background .Net Console.WriteLine is null safe. But, then some functions may not be. To protect yourself in the case of nullable variables, please consider the use of the ?? operator. Code Output Image Textual References Microsoft Learn > .NET > C# guide > Language reference > Operators and expressions ?? and ??= operators … Continue reading .Net:- Operator – The null-coalescing operator ??
Background Let us go with our old stand by. HelloWorld. Language Language - C Script Code Output Output Image Using tio.run c / gcc compiler Output - Text Language - C# C# - Without Class Definition Outline Let us convert our c code to C#. Code Changes Import c:- #include <stdio.h> Include stdio.h … Continue reading C#:- Compiler Error – “The entry point of the program is global code; ignoring ‘Main(string)’ entry point”
Background Last night after a long day of code rewrite, ran into an error that threatened to force me to discard the numerous optimizations I had taken the time and effort to labor over. Error Message Here is the full error message:- Remediation Outline Code Review Code Rewrite Code Review Please review your code. … Continue reading .Net Error:- “COM object that has been separated from its underlying RCW cannot be used”
Background A very quick post on a very easy to address C# error. Error Image Text 'Person':type used in a using statement must be implicitly convertible to 'System.IDisposable'. Scenario #1 A very simple scenario. We have a class called Person. The class has a simple property called name. We initialize the class and … Continue reading C# – Error – “type used in a using statement must be implicitly convertible to ‘System.IDisposable’.”
Background Continuing to play around with .Net C#. Specifically, Generics. Ran into an error I could not get beyond. Error Error Message Code Error Message TroubleShooting Add Namespace Code Preface usage by indicating the code uses classes in the System.Collections.Generic namespace. Error Compiled and got an error that reads:- Remediation Add Third-Party Namespaces … Continue reading .Net – Compilation Error Message – “error CS0246: The type or namespace name ‘[interface]’ could not be found (are you missing a using directive or an assembly reference?)”
Background Using Visual Studio to compile an application. Ran into a little error. Error Messages Error Messages - Text Error CS0246 The type or namespace name 'ManagementScope' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'ObjectQuery' could not be found (are you missing a … Continue reading Visual Studio – Compilation – Error – “The type or namespace name ‘ManagementScope’ could not be found (are you missing a using directive or an assembly reference?)”
Background Attempting to build a .Net core application, but ran into a blocking error. Request So to compile a .Net Core application, from the command line, I will simply navigate to the solution folder and issue a "dotnet build" command. Error Error Messages Textual error CS0101: The namespace [project] already contains a definition error … Continue reading .Net Core – Compilation Error – CS0101 – “The namespace already contains a definition” // “Type already defines a member with the same parameter types”
Background Wanted to highlight an error one might experience trying to build a Visual Studio Application from the command line. Error Error - Image Error - Text error MSB4066: The attribute "Version" in element is unrecognized. Troubleshooting Google Googled on the error message and thanks goodness Stack Overflow came to rescue. The solution is to … Continue reading MSBuild – Error – ‘error MSB4066: The attribute “Version” in element is unrecognized.’