CSharp examples for Custom Type:Field
Create class with public fields
using System;/* ww w. j a v a2 s. co m*/ using System.Collections.Generic; using System.Text; public class Person { public string FirstName; public string LastName; public int Age; private decimal _salary; public Person() { //Empty constructor } public Person(string firstName, string lastName, int age, decimal salary=45000) { FirstName = firstName; LastName = lastName; Age = age; //default value _salary = salary; } } class Program { static void Main(string[] args) { Person person = new Person(); person.FirstName = "J"; person.LastName = "S"; person.Age = 44; Console.WriteLine("{0} {1} - age: {2}", person.FirstName, person.LastName, person.Age); } }