Define struct and use it : struct « Class Interface « C# / C Sharp
- C# / C Sharp
- Class Interface
- struct
Define struct and use it
/*
* C# Programmers Pocket Consultant
* Author: Gregory S. MacBeth
* Email: [email protected]
* Create Date: June 27, 2003
* Last Modified Date:
*/
using System;
namespace Client.Chapter_3___Structs__Enums__Arrays_and_Classes
{
public struct MyStruct
{
public int MyInt;
public long MyLong;
public string MyString;
}
public class StructsChapter_3___Structs__Enums__Arrays_and_Classes
{
static void Main(string[] args)
{
MyStruct TheStruct;
TheStruct.MyInt = 0;
TheStruct.MyLong = 0;
TheStruct.MyString = "Hello World";
}
}
}
Related examples in the same category