Question: I want to search keys from edis using keys operation. However the number of results around 1 million. But I just want to get max 300 keys in descending order.

```
@Autowired
private StringRedisTemplate redisTemplate;

...

redisTemplate.keys("rec:*:type:3001:bill:*").stream().sorted(Collections.reverseOrder()).forEach((receivedBill) -> {

});;

```

Any way can I limit the size of result set of keys?

Answer: 
First, you're not using the standard C++, you're using the managed C++([C++/CLI](https://msdn.microsoft.com/en-us/library/68td296t.aspx)). The difference is: the standard C++ only deal with native memory; while C++/CLI is built on CLR(Common language runtime), it can access both native and managed memory.

So for your code:

```
char NodeSetting[8] = "Setting";

```

This line defines a variable which is native, not a managed one. While for the name of XAttribute, it required a manage one(a reference object), so you should use this:

```
 String^ NodeSetting = gcnew String("Setting");

```
Got it after all.
You can't use gcnew XName() as you can't assign the name
you can't also just use XAttribute("STRING",Value);

But you CAN use XAttribute(gcnew String("STRING"),Value);