Wednesday, March 28, 2018

C# 7 New Features


C# 7 adds a number of new features and focuses on data consumption, code simplification and performance. The biggest features have already been considered - tuples, local functions, matching with the pattern and throwing expressions. But there are other new opportunities, both large and small. They all combine to make the code more efficient and understandable, so that everyone is happy and productive.

Let's look at the rest of the features of the new version of C #. So! Let's start!

Out

Currently, in C #, using out parameters is not as flexible as we would like. Before calling a method with out parameters, you first need to declare the variables to pass to the method. Because these variables are usually not initialized (since they will be overwritten by the method), you can not use var for their declaration, so you must always specify the full type:

public void PrintCoordinates(Point p)
{
  int x, y; // have to "predeclare"
  p.GetCoordinates(out x, out y);
  WriteLine($"({x}, {y})");
}

Literals Improvements



var d = 123_456;
var x = 0xAB_CD_EF;

You can put this _ symbol anywhere between the numbers the right number of times to improve readability. It does not affect the value. This separator can be used with the types byte, int, long, decimal, float and double.

Thursday, February 22, 2018

Become a Published Author on CodeFlex.co


Codeflex.co is a software development & DevOps community web portal that allows to every developer become a recognized expert in the field by publishing their articles directly on CodeFlex website.



What are your benefits?

  • You’ll reach a worldwide audience of targeted readers.
  • You’ll build your reputation as an expert in the software development and DevOps.
  • Recruiters from the best companies will be impressed by your expertise - you'll get your job easily. 
  • You’ll improve your writing skills.
  • You’ll contribute to the community, sharing is caring.

Submission Guidelines

The CodeFlex articles may be of any topic but related to the technology field. We would love to publish articles in various categories including, but not limited to, programming languages, iOS/Android development, software architecture, open source, DevOps techniques etc. 
The newest technologies like Big Data, AI, Machine Learning, Microservices, Cloud Technologies, DevOps are more than welcomed.
Please follow the guidelines below when submitting an article:
  • The article you provide has to be exclusively written for CodeFlex.co. 
  • Only unique content is allowed. In case the content is found to be duplicated, article will be rejected.
  • The article should be of at least 250 words.
  • The article has to be sent in MS Word format or similar (e.g. OpenOffice).
  • If applicable, your article should include also images such as diagrams, charts, graphs etc Images should be of the standard types (JPG, PNG, GIF. The images have to be embedded in your document.
  • Please ensure copyright laws are followed on all images and content taken from web. Always provide appropriate credits to the original site or the owner if necessary.
  • When your article is published you are welcomed to reply to any visitor’s comments. This will provide more exposure and engagement for your article.
  • Any comment or topic that is insulting, abusive, sexual, offensive or breaks the law will not be tolerated.
  • CodeFlex team retain the right to reject any article that does not comply to the aforementioned guidelines without further explanation.
Your submitted article should also include:
  • Title (Mandatory)
  • Keywords (Optional)
  • References (Optional)
  • About the author (Mandatory) - Your name, links, bio and if you wish your photo to be published.
Please note that currently you are not allowed to directly publish your article. All submitted articles are reviewed and moderated first before they are published.

Send your articles to:

 

Java File to String in one Line


This is the shortest version of how to read a file and convert it to String in Java:

String myFile = "";
try{
    myFile = new String(Files.readAllBytes(Paths.get(myFile.txt)) );
}
catch (IOException e)
{
    e.printStackTrace();
}