csharp: changing string literal with nameof.

Summary: ref T8407

Reviewers: lauromoura, felipealmeida, YOhoho, jptiz

Reviewed By: jptiz

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8407

Differential Revision: https://phab.enlightenment.org/D10668
This commit is contained in:
Lauro Moura 2019-12-09 08:32:02 -03:00
parent ed43683955
commit 25e2ed3b2f
4 changed files with 21 additions and 25 deletions

View File

@ -147,12 +147,10 @@ public class Array<T> : IEnumerable<T>, IDisposable
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
public Array(IntPtr handle, bool own) public Array(IntPtr handle, bool own)
{ {
if (handle == IntPtr.Zero) Handle = (handle != IntPtr.Zero)
{ ? handle
throw new ArgumentNullException("handle", "Handle can't be null"); : throw new ArgumentNullException(nameof(handle),
} $"{nameof(Handle)} can't be null");
Handle = handle;
Own = own; Own = own;
OwnContent = own; OwnContent = own;
} }
@ -166,12 +164,10 @@ public class Array<T> : IEnumerable<T>, IDisposable
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
public Array(IntPtr handle, bool own, bool ownContent) public Array(IntPtr handle, bool own, bool ownContent)
{ {
if (handle == IntPtr.Zero) Handle = (handle != IntPtr.Zero)
{ ? handle
throw new ArgumentNullException("handle", "Handle can't be null"); : throw new ArgumentNullException(nameof(handle),
} $"{nameof(Handle)} can't be null");
Handle = handle;
Own = own; Own = own;
OwnContent = ownContent; OwnContent = ownContent;
} }

View File

@ -298,7 +298,7 @@ public class Connection : IDisposable
if (msg == null) if (msg == null)
{ {
throw new ArgumentNullException("msg"); throw new ArgumentNullException(nameof(msg));
} }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
@ -347,7 +347,7 @@ public class Connection : IDisposable
if (bus == null) if (bus == null)
{ {
throw new ArgumentNullException("bus"); throw new ArgumentNullException(nameof(bus));
} }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
@ -376,7 +376,7 @@ public class Connection : IDisposable
if (bus == null) if (bus == null)
{ {
throw new ArgumentNullException("bus"); throw new ArgumentNullException(nameof(bus));
} }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
@ -405,7 +405,7 @@ public class Connection : IDisposable
if (bus == null) if (bus == null)
{ {
throw new ArgumentNullException("bus"); throw new ArgumentNullException(nameof(bus));
} }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
@ -434,7 +434,7 @@ public class Connection : IDisposable
if (bus == null) if (bus == null)
{ {
throw new ArgumentNullException("bus"); throw new ArgumentNullException(nameof(bus));
} }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());
@ -533,7 +533,7 @@ public class Connection : IDisposable
if (bus == null) if (bus == null)
{ {
throw new ArgumentNullException("bus"); throw new ArgumentNullException(nameof(bus));
} }
IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr());

View File

@ -146,17 +146,17 @@ public class Object : System.IDisposable
{ {
if (conn == null) if (conn == null)
{ {
throw new System.ArgumentNullException("conn"); throw new System.ArgumentNullException(nameof(conn));
} }
if (bus == null) if (bus == null)
{ {
throw new System.ArgumentNullException("bus"); throw new System.ArgumentNullException(nameof(bus));
} }
if (path == null) if (path == null)
{ {
throw new System.ArgumentNullException("path"); throw new System.ArgumentNullException(nameof(path));
} }
var handle = eldbus_object_get(conn.Handle, bus, path); var handle = eldbus_object_get(conn.Handle, bus, path);
@ -316,7 +316,7 @@ public class Object : System.IDisposable
if (msg == null) if (msg == null)
{ {
throw new System.ArgumentNullException("msg"); throw new System.ArgumentNullException(nameof(msg));
} }
IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr(); IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr();

View File

@ -24,7 +24,7 @@ using static eldbus.EldbusProxyNativeFunctions;
namespace eldbus namespace eldbus
{ {
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
internal static class EldbusProxyNativeFunctions internal static class EldbusProxyNativeFunctions
{ {
[DllImport(efl.Libs.Eldbus)] public static extern IntPtr [DllImport(efl.Libs.Eldbus)] public static extern IntPtr
@ -215,7 +215,7 @@ public class Proxy : IDisposable
if (member == null) if (member == null)
{ {
throw new ArgumentNullException("member"); throw new ArgumentNullException(nameof(member));
} }
var ptr = eldbus_proxy_method_call_new(Handle, member); var ptr = eldbus_proxy_method_call_new(Handle, member);
@ -233,7 +233,7 @@ public class Proxy : IDisposable
if (msg == null) if (msg == null)
{ {
throw new ArgumentNullException("msg"); throw new ArgumentNullException(nameof(msg));
} }
// Native send() takes ownership of the message. We ref here to keep the IDisposable // Native send() takes ownership of the message. We ref here to keep the IDisposable