.net

Parameterless Constructor for a struct in C# 6.0

Posted on

In our previous article, we have discussed the new features introduced in C# 6.0. You can go through that here. In this article,we will discuss: Parameterless Constructor for a struct How to define Parameterless Struct   Parameterless Constructor for a struct: In earlier versions of C#, the structures or struct types were unable to support […]

.net

Auto Property Initializer in C# 6.0

Posted on

In our previous article, we have discussed the new features introduced in C# 6.0. You can go through that here. In this article, you will learn: Auto Property Initializer in C# What is Auto Property Initializer in C#? How it works? What is Auto Property Initializer in C# ? This feature enable you to set the […]

.net

Difference Between Constant, ReadOnly and Static ReadOnly in C#

Posted on

In this article, we will discuss the very common keywords in C# (constant, ReadOnly and Static ReadOnly) and discuss the difference between these keywords. Constants: A constant is a variable modifier that represents a constant value, a value that can be computed at compile-time.By default a const is static and we cannot change the value […]

.net

Global.asax in ASP.net

Posted on

Global.asax: The Global.asax is also known as the ASP.NET application file and is used to serve application-level and session-level events. It allows us to write code that response to global application events raised by ASP.NET or by HttpModules. These events fire at various points during the lifetime of a web application, including when the application domain is […]

.net

Difference between == and .Equals method in csharp

Posted on

For Value Type: == and .Equals() method usually compare two objects by value. For Example: int x = 20; int y = 20; Console.WriteLine( x == y); Console.WriteLine(x.Equals(y)); Output: True True For Reference Type: == performs an identity comparison, i.e. it will only return true if both references point to the same object. While Equals() […]

.net

How to Read a Text File One Line at a Time

Posted on

This example reads the contents of a text file, one line at a time, into a string using the ReadLine method of the StreamReader class. Each text line is stored into the string line and displayed on the screen

© 2015, www.techkatak.com. All rights reserved.

.net

How to Write to a text file in C#

Posted on

In this article, we will learn: how to write data to a text file in C#. The first two examples use static convenience methods on the System.IO.File class to write each element of any IEnumerable<string> and a string to a text file. Example 3 shows how to add text to a file when you have to […]