How to shorten the name when using RTL library

Hello,

I have the following codes:

using System.Linq;
using System.Text;
using Gtk;
using RemObjects.Elements.RTL;
using static System.Console;

namespace CSharpDotnet
{
static class Program
{
public static Int32 Main(string[] args)
{

		RemObjects.Elements.RTL.String myStr="Hello";
		WriteLine(myStr);
		ReadLine();

	}

}

}

I know that, I can use “using static System.Console;” then in the codes, just use WriteLine and ReadLine

But how can I shorten the name when I use the RTL library?

For example, I don’t want to type the long declarion every time:

RemObjects.Elements.RTL.String myStr=“Hello”;

Thanks.

Regards,
Xiaoguang

If you have RemObjects.Elements.RTL in the using, you don’t need to type it out in code, you can just use “String” without prefix. That’s what the using is for :).

OK.

So if I type String myStr=“Hello”, in .net core it will map to String in .net, in JAVA it will map to String in Java, right?

very cool, it’s brilliant.

It’ll do that even without Elements RTL. What `using RemObjects.Elements.RTL does is that it uses the mapped String type from Elements RTL that looks and behaves the same on reach platform (but still maps to the native string).

1 Like