Xamarin.iOS 中 NSString stringWithFormat 的等价物是什么

What is the equivalent of NSString stringWithFormat in Xamarin.iOS

我正在使用 Azure 通知中心发送通知。我希望这些通知是多语言的,但我找不到

的等价物
NSString* jsontemplate= [NSString stringWithFormat:@"{\"aps\":
{\"alert\":\"$(News_%@)\"},\"inAppMessage\":\"$(News_%@)\"}",
localeString, localeString];

在函数中使用

Hub.RegisterTemplateAsync(deviceToken,name,jsontemplate,expirytemplate,tags, 
(errorCallback) => {
  if (errorCallback != null)
    Console.WriteLine("RegisterNativeAsync error: " +  errorCallback.ToString());                });

这将替代我现在拥有的下面代码片段中的函数 Hub.RegisterNativeAsync,它可以很好地用于简单的通知。

public override void RegisteredForRemoteNotifications(UIApplication     application, NSData deviceToken)
    {
        Hub = new SBNotificationHub(TnOConstants.AzureListenConnectionString, TnOConstants.AzureNotificationHubName);

        Hub.UnregisterAllAsync (deviceToken, (error) => {
            if (error != null)
            {
                Console.WriteLine("Error calling Unregister: {0}", error.ToString());
                return;
            }

            string[] tag = new string[]{"tnoios", "ios-"+ appVersion.ToString()};

            NSSet tags = new NSSet(tag);
            Hub.RegisterNativeAsync(deviceToken, tags, (errorCallback) => {
                if (errorCallback != null)
                    Console.WriteLine("RegisterNativeAsync error: " + errorCallback.ToString());
            });
        });
    }

我正在学习本教程https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-ios-send-localized-breaking-news/

我最终使用 String.Format() 的模板相当于上述短语的 NSString stringWithFormat 是:

string template = String.Format(@"{""aps"":{""alert"":""$({0})""}}", localeString);