Lina  Biyinzika

Lina Biyinzika

1623045060

A Closer Look at 5 New Features in C# 10

We’ve been speculating about the future of C## 10 for a while. The possibilities are no secret. Spend some time on the C## GitHub page and you’ll find a long list of tantalizing ideas — some with major headaches still being hashed out. Many of them won’t make it into the next version of C#, and some of them won’t appear in the language ever. (There’s a high bar to get into C#, because the language mandates that once a keyword or syntactical structure is supported, its behavior should never change in a breaking way for the rest of all eternity.)

If you want to know what’s actually confirmed for C## 10, you could wait for the language to be released in November along with .NET 6. Or, you could follow the fine people on the C## team as they demonstrate their favorite features. Last week at Microsoft’s Build conference, lead C## designer Mads Torgersen pulled the covers off some of the work that’s currently underway. Here are five new features you’ll see in the next release of the language.

1. Global usings

A typical C## source code file begins with a pile of namespace imports. Here’s a snippet from an ordinary ASP.NET web application:

using LoggingTestApp.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LoggingTestApp
{
    public class Startup
    {
        ...
    }
}

2. File-scoped namespaces

Another way to streamline your code in C## 10 is to declare a file-scoped namespace for your code. The file-scoped namespace applies automatically to your entire file, with no need to indent anything.

3. Null parameter checking

In the same spirit of reducing boilerplate, C## has a very nice new feature called null parameter checking. No doubt you’ve written a method that’s had to reject null values before. You probably used code that looked like this:

public UpdateAddress(int personId, Address newAddress)
{
    if (newAddress == null)
    {
        throw new ArgumentNullException("newAddress");
    }
    ...
}

4. Required properties

In the old days, you relied on class constructors almost exclusively to make sure objects were created in the right state. Today, we often work with more lightweight constructs, like the autoimplemented properties in this record:

public record Employee
{
    public string Name { get; init; }
    public decimal YearlySalary { get; init; }
    public DateTime HiredDate{ get; init; }
}

5. The field keyword

The C## team has done a lot to streamline code over the years with autoimplemented properties. The Employee record shown above is a good example — it declares three immutable properties using the get and init keywords. The data is stored in three private fields, but these fields are created for you automatically, and managed without your intervention. You never see them.

Autoimplemented properties are great, but they can only take you so far. When they don’t suit, you’re forced to add the backing field to your class and write the usual property methods like you’re back in C## version 2. But in C## 10, there’s a new backdoor with the field keyword, which exposes the automatically created backing field.

#dotnet #programming #csharp #c

What is GEEK

Buddha Community

A Closer Look at 5 New Features in C# 10
Cyril  Parisian

Cyril Parisian

1626227242

C# 10 - Top 5 New Features in the Upcoming C# Version

C## has been around for a while. Since January 2002, to be more precise. As we wait for the 20th birthday of this popular programming language, we are expecting its new version as well. C## 10 doesn’t have an official release date yet, although it will probably be released in November along with the .NET 6. If you follow its GitHub page , you can find a lot of features and ideas that are suggested for the new version of the language.

This can be a bit overwhelming, however, if you follow Microsoft conferences and listen to what some of the C## designers are saying and cross-check it with suggestions on the Github page, you can get a nice picture of what is coming next for C#. For example, you can check out this Microsoft Build conference from May and you can find a lot of interesting information . Here are five new features that we will see in the new version of C#:

  • 1. Null Parameter Checking
  • 2. Required Properties
  • 3. Field Keyword
  • 4. Global Usings
  • 5. File Namespaces

#.net #c# #.net 5 #.net 6 #c# 10 #csharp #top 5

Tamale  Moses

Tamale Moses

1624240146

How to Run C/C++ in Sublime Text?

C and C++ are the most powerful programming language in the world. Most of the super fast and complex libraries and algorithms are written in C or C++. Most powerful Kernel programs are also written in C. So, there is no way to skip it.

In programming competitions, most programmers prefer to write code in C or C++. Tourist is considered the worlds top programming contestant of all ages who write code in C++.

During programming competitions, programmers prefer to use a lightweight editor to focus on coding and algorithm designing. VimSublime Text, and Notepad++ are the most common editors for us. Apart from the competition, many software developers and professionals love to use Sublime Text just because of its flexibility.

I have discussed the steps we need to complete in this blog post before running a C/C++ code in Sublime Text. We will take the inputs from an input file and print outputs to an output file without using freopen file related functions in C/C++.

#cpp #c #c-programming #sublimetext #c++ #c/c++

Dicey Issues in C/C++

If you are familiar with C/C++then you must have come across some unusual things and if you haven’t, then you are about to. The below codes are checked twice before adding, so feel free to share this article with your friends. The following displays some of the issues:

  1. Using multiple variables in the print function
  2. Comparing Signed integer with unsigned integer
  3. Putting a semicolon at the end of the loop statement
  4. C preprocessor doesn’t need a semicolon
  5. Size of the string matters
  6. Macros and equations aren’t good friends
  7. Never compare Floating data type with double data type
  8. Arrays have a boundary
  9. Character constants are different from string literals
  10. Difference between single(=) and double(==) equal signs.

The below code generates no error since a print function can take any number of inputs but creates a mismatch with the variables. The print function is used to display characters, strings, integers, float, octal, and hexadecimal values onto the output screen. The format specifier is used to display the value of a variable.

  1. %d indicates Integer Format Specifier
  2. %f indicates Float Format Specifier
  3. %c indicates Character Format Specifier
  4. %s indicates String Format Specifier
  5. %u indicates Unsigned Integer Format Specifier
  6. %ld indicates Long Int Format Specifier

Image for post


A signed integer is a 32-bit datum that encodes an integer in the range [-2147483648 to 2147483647]. An unsigned integer is a 32-bit datum that encodes a non-negative integer in the range [0 to 4294967295]. The signed integer is represented in twos-complement notation. In the below code the signed integer will be converted to the maximum unsigned integer then compared with the unsigned integer.

Image for post

#problems-with-c #dicey-issues-in-c #c-programming #c++ #c #cplusplus

Layne  Fadel

Layne Fadel

1622066880

What Employers Exactly Look for in a C/C++ Job Description

Nine times out of ten, you will come across a job ad that lists C/C++ as a skill requirement.

No matter the company, the job title, or the salary, you will likely find that the job description lists C/C++ as a required skill. Better yet, they want you to have 10+ years of experience using these technologies.

Why are these two languages from the 70s and 80s required for modern-day software developer positions?

Some will joke and say it’s because the employers are looking for candidates over the age of 50. Others will say it’s because the HR hiring managers have a lukewarm IQ that led them to copy and paste whatever Google listed as popular programming languages.

The bottom line is that anyone at any level in their software development career will come across this requirement for any job under the sun, be it as a software engineer, web developer, game programmer, or app developer. With so many different companies looking for this skill for any number of positions, it begs the question: what are recruiters actually looking for when they list C/C++ in a job description?

At this point, it’s pure speculation as to what recruiters really want. However, a few good explanations can help future software developers wisely navigate the omnipresent C/C++ requirement.

Employers Are Looking for You To Fill Any Number of Roles Within a Company.

Having an understanding of C and C++ allows you to fill any number of roles within a company.

Employers will often include C/C++ as a skill requirement as part of a broad job description to find candidates who could fulfill any number of positions or job requirements under the software developer umbrella. Often, employers are looking for someone who can do any of the following:

  • Someone who can work with systems administration tasks.
  • Someone who can maintain existing C/C++ code.
  • Someone who can do heavy academia-related coding work.
  • Someone who can be a game developer.
  • Someone who can work with Android NDK apps.
  • Someone very comfortable with memory management.

All of the tasks above can be done using more modern programming languages, yet are often taken over or completed using C or C++. C and C++, while ancient languages in terms of the speed at which technology modernizes, are still relevant for many different tasks that you may come across as a developer.

#software-development #programming #c #c++ #c/c++

Lina  Biyinzika

Lina Biyinzika

1623045060

A Closer Look at 5 New Features in C# 10

We’ve been speculating about the future of C## 10 for a while. The possibilities are no secret. Spend some time on the C## GitHub page and you’ll find a long list of tantalizing ideas — some with major headaches still being hashed out. Many of them won’t make it into the next version of C#, and some of them won’t appear in the language ever. (There’s a high bar to get into C#, because the language mandates that once a keyword or syntactical structure is supported, its behavior should never change in a breaking way for the rest of all eternity.)

If you want to know what’s actually confirmed for C## 10, you could wait for the language to be released in November along with .NET 6. Or, you could follow the fine people on the C## team as they demonstrate their favorite features. Last week at Microsoft’s Build conference, lead C## designer Mads Torgersen pulled the covers off some of the work that’s currently underway. Here are five new features you’ll see in the next release of the language.

1. Global usings

A typical C## source code file begins with a pile of namespace imports. Here’s a snippet from an ordinary ASP.NET web application:

using LoggingTestApp.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LoggingTestApp
{
    public class Startup
    {
        ...
    }
}

2. File-scoped namespaces

Another way to streamline your code in C## 10 is to declare a file-scoped namespace for your code. The file-scoped namespace applies automatically to your entire file, with no need to indent anything.

3. Null parameter checking

In the same spirit of reducing boilerplate, C## has a very nice new feature called null parameter checking. No doubt you’ve written a method that’s had to reject null values before. You probably used code that looked like this:

public UpdateAddress(int personId, Address newAddress)
{
    if (newAddress == null)
    {
        throw new ArgumentNullException("newAddress");
    }
    ...
}

4. Required properties

In the old days, you relied on class constructors almost exclusively to make sure objects were created in the right state. Today, we often work with more lightweight constructs, like the autoimplemented properties in this record:

public record Employee
{
    public string Name { get; init; }
    public decimal YearlySalary { get; init; }
    public DateTime HiredDate{ get; init; }
}

5. The field keyword

The C## team has done a lot to streamline code over the years with autoimplemented properties. The Employee record shown above is a good example — it declares three immutable properties using the get and init keywords. The data is stored in three private fields, but these fields are created for you automatically, and managed without your intervention. You never see them.

Autoimplemented properties are great, but they can only take you so far. When they don’t suit, you’re forced to add the backing field to your class and write the usual property methods like you’re back in C## version 2. But in C## 10, there’s a new backdoor with the field keyword, which exposes the automatically created backing field.

#dotnet #programming #csharp #c