Sponsored Ad

Tuesday, January 11, 2011

WriteOnly Property Implementation using C#

This is simple program to implement the writeonly property in C#. As name states you can only write only ready. There is no general signification of such type of property.

 

C# Source Code:

using System;

namespace ConsoleApp
{
    class Program
    {
        private static int WriteOnly = 0;
        public static int my_value
        {
            set
            {
                WriteOnly = value;
            }
        }
        static void Main(string[] args)
        {
            //Error
            //Console.WriteLine(my_value);           
            my_value = 200;

            Console.ReadLine();
        }
    }
}

0 comments:

Post a Comment

Sponsored Ad

Website Update

Followers