Concise C# Property Name

When constructing XML elements, it’s nice to have a concise API.

One of the features I’m implementing is the ability to easily move up to a parent element. There’s no cascade operator in C#, like you see in Dart.

Whilst exploring options, I found this works:

Example usage:

var e = new BvElement("iq");
Console.WriteLine(e._.Name);

I thought that was interesting – albeit obvious when you think about it 🙂

But on a serious note, looking for something suitable, appreciate suggestions.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s