Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(713)

Delta Between Two Patch Sets: Src/GoogleApis/Apis/Util/Utilities.cs

Issue 13972043: Issue 351: Reimplement OAuth2 (Step 3 - Tests, Flows and Credential) (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: minor Created 10 years, 10 months ago
Right Patch Set: minor Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Src/GoogleApis/Apis/Util/Store/IDataStore.cs ('k') | Src/GoogleApis/Properties/AssemblyInfo.cs » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 Copyright 2010 Google Inc 2 Copyright 2010 Google Inc
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at 6 You may obtain a copy of the License at
7 7
8 http://www.apache.org/licenses/LICENSE-2.0 8 http://www.apache.org/licenses/LICENSE-2.0
9 9
10 Unless required by applicable law or agreed to in writing, software 10 Unless required by applicable law or agreed to in writing, software
(...skipping 14 matching lines...) Expand all
25 /// <summary>A utility class which contains helper methods and extension met hods.</summary> 25 /// <summary>A utility class which contains helper methods and extension met hods.</summary>
26 public static class Utilities 26 public static class Utilities
27 { 27 {
28 /// <summary>Returns the version of the core library.</summary> 28 /// <summary>Returns the version of the core library.</summary>
29 internal static string GetLibraryVersion() 29 internal static string GetLibraryVersion()
30 { 30 {
31 return Regex.Match(typeof(Utilities).Assembly.FullName, "Version=([\ \d\\.] )").Groups[1].ToString(); 31 return Regex.Match(typeof(Utilities).Assembly.FullName, "Version=([\ \d\\.] )").Groups[1].ToString();
32 } 32 }
33 33
34 /// <summary>Throws an <seealso cref="System.ArgumentNullException"/> if the object is null.</summary> 34 /// <summary>Throws an <seealso cref="System.ArgumentNullException"/> if the object is null.</summary>
35 internal static void ThrowIfNull(this object obj, string paramName) 35 internal static T ThrowIfNull<T>(this T obj, string paramName)
36 { 36 {
37 if (obj == null) 37 if (obj == null)
38 { 38 {
39 throw new ArgumentNullException(paramName); 39 throw new ArgumentNullException(paramName);
40 } 40 }
41
42 return obj;
41 } 43 }
42 44
43 /// <summary> 45 /// <summary>
44 /// Throws an <seealso cref="System.ArgumentNullException"/> if the stri ng is <c>null</c> or empty. 46 /// Throws an <seealso cref="System.ArgumentNullException"/> if the stri ng is <c>null</c> or empty.
45 /// </summary> 47 /// </summary>
46 /// <returns>The original string</returns> 48 /// <returns>The original string</returns>
47 internal static string ThrowIfNullOrEmpty(this string str, string paramN ame) 49 internal static string ThrowIfNullOrEmpty(this string str, string paramN ame)
48 { 50 {
49 if (string.IsNullOrEmpty(str)) 51 if (string.IsNullOrEmpty(str))
50 { 52 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 var enumType = o.GetType(); 103 var enumType = o.GetType();
102 FieldInfo field = enumType.GetField(o.ToString()); 104 FieldInfo field = enumType.GetField(o.ToString());
103 StringValueAttribute attribute = field.GetCustomAttribute<String ValueAttribute>(); 105 StringValueAttribute attribute = field.GetCustomAttribute<String ValueAttribute>();
104 return attribute != null ? attribute.Text : o.ToString(); 106 return attribute != null ? attribute.Text : o.ToString();
105 } 107 }
106 108
107 return o.ToString(); 109 return o.ToString();
108 } 110 }
109 } 111 }
110 } 112 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b