Skip to content

Simple C# source generator to add byte order reversal to structs

License

Notifications You must be signed in to change notification settings

gio3k/ReverseStruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReverseStruct

Simple C# source generator that adds byte order reversal to structs

https://www.nuget.org/packages/giodotblue.ReverseStruct/

Usage

using ReverseStruct;

namespace MyNamespace;

// create an extension class with the [Reversible] attribute...
[Reversible]
public struct StructA
{
	public int Value;
}

// or use IReversible to generate ReverseEndianness() as part of your struct... 
public partial struct StructB : IReversible
{
	// nested structs work fine!
	public StructA Foo;
	public uint Bar;
}

public static class Program
{
	public static void Main( string[] args )
	{
		var test = new StructB();
		test.ReverseEndianness();
	}
}

About

Simple C# source generator to add byte order reversal to structs

Topics

Resources

License

Stars

Watchers

Forks

Languages