DotNetOpenAuth.OpenId.Realm.SafeUriBuilderToString C# (CSharp) Method

SafeUriBuilderToString() private static method

Calls UriBuilder.ToString if the argument is non-null. Otherwise throws ArgumentNullException.
This simple method is worthwhile because it checks for null before dereferencing the UriBuilder. Since this is called from within a constructor's base(...) call, this avoids a NullReferenceException when we should be throwing an ArgumentNullException.
private static SafeUriBuilderToString ( UriBuilder realmUriBuilder ) : string
realmUriBuilder System.UriBuilder The realm URI builder.
return string
		private static string SafeUriBuilderToString(UriBuilder realmUriBuilder) {
			Requires.NotNull(realmUriBuilder, "realmUriBuilder");

			// Note: we MUST use ToString.  Uri property throws if wildcard is present.
			// Note that Uri.ToString() should generally be avoided, but UriBuilder.ToString()
			// is safe: http://blog.nerdbank.net/2008/04/uriabsoluteuri-and-uritostring-are-not.html
			return realmUriBuilder.ToString();
		}