Use method in structure to initialize its member fields - CSharp Custom Type

CSharp examples for Custom Type:struct

Description

Use method in structure to initialize its member fields

Demo Code

using System;// w w w. j  av a 2s  .c om
public struct Simple
{
    public int i;
    private string s;
    public void init()
    {
        i = 10;
        s = "Hello";
    }
}
public class T
{
    public static void Main()
    {
        Simple simple = new Simple();
        simple.init();
    }
}

Related Tutorials