Wednesday, July 17, 2019

What is Yield in C# and when to use it

Yield is a keyword in C# which is not understood properly by many people. So what is yield? When you specify yield you'll only get next element from an iterator. Means you'll use yield with an iterator. This removes the need of an extra class or logic which holds the collection.

Simple example of usage of yield keyword



In the above example you are returning the results list. Which is an extra parameter. You can remove this by introducing yield keyword to temporary hold the value in each iteration.

By using yield you don't have to iterate the complete collection. You can breakaway from the collection using break statement. 

Good use cases of yield is when converting DataTable to IEnumerable<T>. Also see when not to use yield.


Monday, July 1, 2019

SQL Databases in Azure

Azure SQL is database-as-a-service. It is high performance, reliable and secure cloud database. Azure SQL can be purchased as Virtual Core based or Database Transaction Unit (DTU) based purchasing models. 

Azure also supports Geo replication for disaster recovery up to 4 instances. Pricing is same as for the primary database.


Data Sync in Azure SQL Databases

With Azure SQL you can synchronize with other databases. This is achieved via Azure SQL Data Sync option.


Improving Performance in Azure SQL

Intelligent Insights can be used to identify and troubleshoot Azure DB performance issues. Locking is a typical situation occurs in SQL databases (See finding locking queries in Azure SQL) Other than that 

  • Reaching resource limits
  • Workload pressure 
are some performance issues which could occur in Azure SQL. 


Securing resources in Azure SQL

Using features like Advanced data security and Dynamic data masking you can improve the security of your data. Dynamic data masking limits sensitive data exposure by masking them to non-privileged users. 

Advanced data security gives you recommendations on database administration. It analyzes and tells you what fields can be classified as well as runs vulnerability tests and gives recommendations. 


Monitoring Azure SQL Database

Database admins can setup alerts in Azure SQL to identify anomalies. There are lot of settings you can define using Azure SQL Alerts
Powered by Blogger.


Software Architect at Surge Global/ Certified Scrum Master

Experienced in Product Design, Software Engineering, Team management and Practicing Agile methodologies.

Search This Blog

Facebook