Here are the examples of the csharp api class string.Format(System.IFormatProvider, string, params object[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
3
1. Example
View licensepublic string ToStringFull() { return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount, this.customPropertiesField.ToStringFull()); }
2
2. Example
View licenseprivate void UpdateDebugText() { if ( debugText ) { debugText.text = string.Format( "Linear: {0}\nAngle: {1}\n", linearMapping.value, outAngle ); } }
1
3. Example
View licensepublic new string ToStringFull() { return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount, this.CustomProperties.ToStringFull()); }
0
4. Example
View licensepublic string ToStringFull() { return string.Format("{0}={2}: {1} \"{3}\"", Name, SupportClassPun.DictionaryToString(Parameters), ReturnCode, DebugMessage); }
0
5. Example
View licensepublic string ToStringFull() { return string.Format("#{0:00} '{1}'{2} {3}", this.ID, this.NickName, this.IsInactive ? " (inactive)" : "", this.CustomProperties.ToStringFull()); }
0
6. Example
View licensepublic override string ToString() { return string.Format("Room: '{0}' {1},{2} {4}/{3} players.", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount); }
0
7. Example
View licenseprivate void UpdateDebugText() { if ( debugText ) { debugText.text = string.Format( "Linear: {0}\nAngle: {1}\n", linearMapping.value, outAngle ); } }
0
8. Example
View licensepublic override string ToString() { return string.Format("[PhotonMessageInfo: Sender='{1}' Senttime={0}]", this.timestamp, this.sender); }
0
9. Example
View licensepublic string ToStringFull() { return string.Format("#{0:00} '{1}'{2} {3}", this.ID, this.NickName, this.IsInactive ? " (inactive)" : "", this.CustomProperties.ToStringFull()); }
0
10. Example
View licenseprivate void NetSimWindow(int windowId) { GUILayout.Label(string.Format("Rtt:{0,4} +/-{1/n ..... /n //View Source file for more details /n }
0
11. Example
View licensevoid OnGUI() { if (InputToEvent.goPointedAt != null) { PhotonView pv = InputToEvent.goPointedAt.GetPhotonView(); if (pv != null) { GUI.Label(new Rect(Input.mousePosition.x + 5, Screen.height - Input.mousePosition.y - 15, 300, 30), string.Format("ViewID {0} {1}{2}", pv.viewID, (pv.isSceneView) ? "scene " : "", (pv.isMine) ? "mine" : "owner: " + pv.ownerId)); } } }
0
12. Example
View licenseprivate void NetSimWindow(int windowId) { GUILayout.Label(string.Format("Rtt:{0,4} +/-{1/n ..... /n //View Source file for more details /n }
0
13. Example
View licensepublic override string ToString() { return string.Format("Room: '{0}' {1},{2} {4}/{3} players.", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount); }
0
14. Example
View licensevoid OnGUI() { if (InputToEvent.goPointedAt != null) { PhotonView pv = InputToEvent.goPointedAt.GetPhotonView(); if (pv != null) { GUI.Label(new Rect(Input.mousePosition.x + 5, Screen.height - Input.mousePosition.y - 15, 300, 30), string.Format("ViewID {0} {1}{2}", pv.viewID, (pv.isSceneView) ? "scene " : "", (pv.isMine) ? "mine" : "owner: " + pv.ownerId)); } } }
0
15. Example
View licensepublic override string ToString() { return string.Format("View ({3}){0} on {1} {2}", this.viewID, (this.gameObject != null) ? this.gameObject.name : "GO==null", (this.isSceneView) ? "(scene)" : string.Empty, this.prefix); }
0
16. Example
View licensepublic override string ToString() { return string.Format("[PhotonMessageInfo: Sender='{1}' Senttime={0}]", this.timestamp, this.sender); }
0
17. Example
View licensepublic override string ToString() { return string.Format("View ({3}){0} on {1} {2}", this.viewID, (this.gameObject != null) ? this.gameObject.name : "GO==null", (this.isSceneView) ? "(scene)" : string.Empty, this.prefix); }
0
18. Example
View licensepublic string ToStringFull() { return string.Format("Room: '{0}' {1},{2} {4}/{3} players.\ncustomProps: {5}", this.nameField, this.visibleField ? "visible" : "hidden", this.openField ? "open" : "closed", this.maxPlayersField, this.PlayerCount, this.customPropertiesField.ToStringFull()); }
0
19. Example
View licensepublic string ToStringFull() { return string.Format("{0}={2}: {1} \"{3}\"", Name, SupportClassPun.DictionaryToString(Parameters), ReturnCode, DebugMessage); }
0
20. Example
View licensepublic override string ToRegexPattern() { string result = string.Format(CultureInfo.InvariantCulture, "(?>{0})", InnerExpression.ToRegexPattern()); if (HasQuantifier) { result += Quantifier.ToRegexPattern(); } return result; }
0
21. Example
View licensepublic override string ToRegexPattern() { string format = string.Empty; switch (LookAroundType) { case RegexLookAround.PositiveLookAhead: format = "(?:{1}(?={0}))"; break; case RegexLookAround.PositiveLookBehind: format = "(?:(?<={0}){1})"; break; case RegexLookAround.NegativeLookAhead: format = "(?:{1}(?!{0}))"; break; case RegexLookAround.NegativeLookBehind: format = "(?:(?<!{0}){1})"; break; } string result = string.Format(CultureInfo.InvariantCulture, format, LookAroundExpression.ToRegexPattern(), MatchExpression.ToRegexPattern()); if (HasQuantifier) { result += Quantifier.ToRegexPattern(); } return result; }
0
22. Example
View licensepublic override string ToRegexPattern() { string result = string.Format ( CultureInfo.InvariantCulture, "(?{0}{1}{2}{3}{4}:{5})", ((Options & RegexOptions.IgnoreCase) == RegexOptions.IgnoreCase) ? "i" : null, ((Options & RegexOptions.Multiline) == RegexOptions.Multiline) ? "m" : null, ((Options & RegexOptions.Singleline) == RegexOptions.Singleline) ? "s" : null, ((Options & RegexOptions.ExplicitCapture) == RegexOptions.ExplicitCapture) ? "n" : null, ((Options & RegexOptions.IgnorePatternWhitespace) == RegexOptions.IgnorePatternWhitespace) ? "x" : null, InnerExpression.ToRegexPattern() ); return result; }
0
23. Example
View licensepublic static string PitchToString(Pitch pitch) { return string.Format("{0}{1}", pitch.NotePreferringSharps(), pitch.Octave()); }
0
24. Example
View licenseprotected string Typeof(IParameter parameter, ISubstitution s) { return string.Format("typeof({0})", s.Apply(parameter.Type).GetPresentableName(CSharpLanguage.Instance)); }
0
25. Example
View licenseprivate BindingFlags GetInvokeMemberBindingFlag(IDeclaredElement declaredElement, bool isAssign) { BindingFlags flag; if (declaredElement is IMethod) { flag = BindingFlags.InvokeMethod; } else if (declaredElement is IField) { flag = isAssign ? BindingFlags.SetField : BindingFlags.GetField; } else if (declaredElement is IProperty) { flag = isAssign ? BindingFlags.SetProperty : BindingFlags.GetProperty; } else { throw new ArgumentException(string.Format("Couldn't process element '{0}'", declaredElement)); } return flag; }
0
26. Example
View licenseprotected string Typeof(IType type, ISubstitution substitution) { return string.Format("typeof({0})", substitution.Apply(type).GetPresentableName(CSharpLanguage.Instance)); }
0
27. Example
View licensepublic override string ToString() { return Elements.Select(element => element.ToString()).DefaultIfEmpty(String.Empty).Aggregate((s1, s2) => String.Format("{0}.{1}", s1, s2)); }
0
28. Example
View licensepublic override string ToString() { return PropertyName.HasContainingTypeName ? String.Format("({0})", PropertyName.LocalName) : PropertyName.LocalName; }
0
29. Example
View licensepublic int EditSettings(ConsoleOptions options) { var settings = this.settingRepository.Load(options.SettingsFile); var message = string.Empty; this.consoleWriter .WriteLine() .WriteLine(Resources.SettingsEditorLaunching) .WriteLine(Resources.SettingsEditorCloseWarning); var view = this.viewFactory.CreateSettings(settings); var result = view.ShowDialog(); if (result.HasValue && result.Value) { this.settingRepository.Save(settings, options.SettingsFile); message = string.Format(Resources.SettingsEditorSavedFormat, options.SettingsFile); } else { message = Resources.SettingsEditorCanceled; } this.consoleWriter .WriteLine() .WriteLine(message); return 0; }
0
30. Example
View licenseprotected void UpdatePersistedObject() { if (null == PersistedObject) { AzureCPLogging.Log( String.Format("PersistedObject {0} should not be null.", Constants.AZURECPCONFIG_NAME), TraceSeverity.Unexpected, EventSeverity.Error, AzureCPLogging.Categories.Configuration); return; } if (null == CurrentTrustedLoginProvider) { AzureCPLogging.Log( "Trust associated with AzureCP could not be found.", TraceSeverity.Unexpected, EventSeverity.Error, AzureCPLogging.Categories.Configuration); return; } // Update object in database SPSecurity.RunWithElevatedPrivileges(delegate() { this.Web.AllowUnsafeUpdates = true; PersistedObject.Update(); this.Web.AllowUnsafeUpdates = false; AzureCPLogging.Log( String.Format("Objects list of AzureCP was successfully updated in PersistedObject {0}.", Constants.AZURECPCONFIG_NAME), TraceSeverity.Medium, EventSeverity.Information, AzureCPLogging.Categories.Configuration); }); ViewState["PersistedObjectVersion"] = PersistedObject.Version; }
0
31. Example
View license[Get("Create")] public virtual object Create() { //check access dynamic newitem = new ExpandoObject(); newitem.Id = null as string; newitem.Title = string.Format("[New {0}]", this.ContentType); newitem = SiteEngine.RunHook(NEW_ITEM, newitem); return RenderView((ExpandoObject)newitem); }
0
32. Example
View licenseinternal static string GetPrompt() { if(!GitViewModel.Current.Tracker.HasGitRepository) return "No Git Repository"; var changed = GitViewModel.Current.Tracker.ChangedFiles; return string.Format("{0} +{1} ~{2} -{3} !{4}", GitViewModel.Current.Tracker.CurrentBranch, changed.Where(f=> f.Status == GitFileStatus.New || f.Status == GitFileStatus.Added).Count(), changed.Where(f => f.Status == GitFileStatus.Modified || f.Status == GitFileStatus.Staged).Count(), changed.Where(f => f.Status == GitFileStatus.Deleted || f.Status == GitFileStatus.Removed).Count(), changed.Where(f => f.Status == GitFileStatus.Conflict).Count() ); }
0
33. Example
View licenseinternal static string GetPrompt(GitFileStatusTracker tracker) { if(tracker==null || !tracker.HasGitRepository) return "No Git Repository"; var changed = tracker.ChangedFiles; return string.Format("{0} +{1} ~{2} -{3} !{4}", tracker.CurrentBranch, changed.Where(f=> f.Status == GitFileStatus.New || f.Status == GitFileStatus.Added).Count(), changed.Where(f => f.Status == GitFileStatus.Modified || f.Status == GitFileStatus.Staged).Count(), changed.Where(f => f.Status == GitFileStatus.Deleted || f.Status == GitFileStatus.Removed).Count(), changed.Where(f => f.Status == GitFileStatus.Conflict).Count() ); }
0
34. Example
View licensepublic override string ToString() { return string.Format(CultureInfo.InvariantCulture, "[{0} '{1}{2}{3}']", base.ToString(), this.Name, this.EqualsSign, this.Value); }
0
35. Example
View licensepublic override string ToString() { return string.Format(CultureInfo.InvariantCulture, "[{0} Chld:{1}]", base.ToString(), this.Children.Count); }
0
36. Example
View licensepublic override string ToString() { return string.Format( CultureInfo.InvariantCulture, "[Block StartLine={0}, LastWord='{1}', Continuation={2}, OneLineBlock={3}, PreviousOneLineBlock={4}]", this.StartLine, this.LastWord, this.Continuation, this.OneLineBlock, this.PreviousOneLineBlock); }
0
37. Example
View licenseprivate void GraphLoaded_Executed(object sender, ExecutedRoutedEventArgs e) { gitViewModel.DisableAutoRefresh(); this.loading.Visibility = Visibility.Collapsed; this.topToolBar.GitViewModel = gitViewModel; this.Title = gitViewModel.Tracker.HasGitRepository ? string.Format("{0} ({1})", gitViewModel.Tracker.GitWorkingDirectory, gitViewModel.Tracker.CurrentBranch) : string.Format("{0} (No Repository)", gitViewModel.WorkingDirectory); gitViewModel.EnableAutoRefresh(); }
0
38. Example
View licensepublic override string ToString() { return string.Format(CultureInfo.InvariantCulture, "[{0} '{1}{2}{3}' Attr:{4}]", base.ToString(), this.OpeningBracket, this.Name, this.ClosingBracket, this.Children.Count); }
0
39. Example
View licenseinternal static string GetPrompt() { if(!GitViewModel.Current.Tracker.HasGitRepository) return "No Git Repository"; var changed = GitViewModel.Current.Tracker.ChangedFiles; return string.Format("{0} +{1} ~{2} -{3} !{4}", GitViewModel.Current.Tracker.CurrentBranch, changed.Where(f=> f.Status == GitFileStatus.New || f.Status == GitFileStatus.Added).Count(), changed.Where(f => f.Status == GitFileStatus.Modified || f.Status == GitFileStatus.Staged).Count(), changed.Where(f => f.Status == GitFileStatus.Deleted || f.Status == GitFileStatus.Removed).Count(), changed.Where(f => f.Status == GitFileStatus.Conflict).Count() ); }
0
40. Example
View licensepublic override string ToString() { return string.Format(CultureInfo.InvariantCulture, "[{0} Text.Length={1}]", base.ToString(), this.EscapedValue.Length); }
0
41. Example
View licensepublic static void OnSyntaxError(AXmlObject obj, int start, int end, string message, params object[] args) { if (end <= start) end = start + 1; string formattedMessage = string.Format(CultureInfo.InvariantCulture, message, args); AXmlParser.Log("Syntax error ({0}-{1}): {2}", start, end, formattedMessage); obj.AddSyntaxError(new SyntaxError() { Object = obj, StartOffset = start, EndOffset = end, Message = formattedMessage, }); }
0
42. Example
View licensepublic override string ToString() { return string.Format(CultureInfo.InvariantCulture, "[{0} '{1}' Attr:{2} Chld:{3} Nest:{4}]", base.ToString(), this.Name, this.HasStartOrEmptyTag ? this.StartTag.Children.Count : 0, this.Children.Count, this.IsProperlyNested ? "Ok" : "Bad"); }
0
43. Example
View licensepublic int GetCurrentFullScreenIndex() { string res = string.Format("{0}x{1}", Settings.UserInterface.FullScreenResolution.Width, Settings.UserInterface.FullScreenResolution.Height); for (int i = 0; i < Resolutions.FullScreenResolutionsList.Count; i++) { if (Resolutions.FullScreenResolutionsList[i].Width == Settings.UserInterface.FullScreenResolution.Width && Resolutions.FullScreenResolutionsList[i].Height == Settings.UserInterface.FullScreenResolution.Height) return i; } return -1; }
0
44. Example
View licensepublic override string ToString() { return string.Format("{0}{1}{2}{3}", Shift ? "Shift+" : string.Empty, Alt ? "Alt+" : string.Empty, Ctrl ? "Ctrl+" : string.Empty, Keystroke.ToString()); }
0
45. Example
View licensevoid ReceiveDamage(DamagePacket p) { Mobile entity = WorldModel.Entities.GetObject<Mobile>(p.Serial, false); if (entity == null) return; m_World.Interaction.ChatMessage(string.Format("{0} takes {1} damage!", entity.Name, p.Damage)); }
0
46. Example
View licensevoid ReceiveTime(TimePacket p) { m_World.Interaction.ChatMessage(string.Format("The current server time is {0}:{1}:{2}", p.Hour, p.Minute, p.Second)); }
0
47. Example
View licensepublic override string ToString() { return string.Format("VPNTH: <{0}> <{1}>", Position.ToString(), TextureCoordinate.ToString()); }
0
48. Example
View licensevoid UpdateLabel(bool isDisposing = false) { if (!isDisposing && Item.Overheads.Count > 0) { if (m_Label == null) { IInputService input = Service.Get<IInputService>(); UserInterface.AddControl(m_Label = new HtmlGumpling(null, 0, 0, 200, 32, 0, 0, string.Format("<center><span style='font-family: ascii3;'>{0}</center>", Item.Overheads[0].Text)), input.MousePosition.X - 100, input.MousePosition.Y - 12); m_Label.MetaData.Layer = UILayer.Over; } } else if (m_Label != null) { { m_Label.Dispose(); m_Label = null; } } }
0
49. Example
View licensepublic int GetCurrentPlayWindowIndex() { string res = string.Format("{0}x{1}", Settings.UserInterface.PlayWindowGumpResolution.Width, Settings.UserInterface.PlayWindowGumpResolution.Height); for (int i = 0; i < Resolutions.PlayWindowResolutionsList.Count; i++) { if (Resolutions.PlayWindowResolutionsList[i].Width == Settings.UserInterface.PlayWindowGumpResolution.Width && Resolutions.PlayWindowResolutionsList[i].Height == Settings.UserInterface.PlayWindowGumpResolution.Height) return i; } return -1; }
0
50. Example
View licensevoid CreateSpellPage(int page, bool rightPage, int circle, SpellDefinition spell) { // header: "NTH CIRCLE" AddControl(new HtmlGumpling(this, 64 + (rightPage ? 148 : 0), 10, 130, 200, 0, 0, string.Format("<span color='#004' style='font-family=uni0;'><center>{0}</center></span>", SpellsMagery.CircleNames[circle])), page); // icon and spell name AddControl(new HtmlGumpling(this, 56 + (rightPage ? 156 : 0), 38, 130, 44, 0, 0, string.Format("<a href='spellicon={0}'><gumpimg src='{1}'/></a>", spell.ID, spell.GumpIconID - 0x1298)), page); AddControl(new HtmlGumpling(this, 104 + (rightPage ? 156 : 0), 38, 88, 40, 0, 0, string.Format( "<a href='spell={0}' color='#542' hovercolor='#875' activecolor='#420' style='font-family=uni0; text-decoration=none;'>{1}</a>", spell.ID, spell.Name)), page); // reagents. AddControl(new HtmlGumpling(this, 56 + (rightPage ? 156 : 0), 84, 146, 106, 0, 0, string.Format( "<span color='#400' style='font-family=uni0;'>Reagents:</span><br/><span style='font-family=ascii6;'>{0}</span>", spell.CreateReagentListString(", "))), page); }