2 using System.Collections.Generic;
3 using System.Diagnostics;
9 public static class Extensions
14 /// COM オブジェクトの参照カウントを取得して返す。
16 /// <param name="unknownObject">COMオブジェクト。</param>
17 /// <returns>現在の参照カウントの値。</returns>
18 public static int GetRefferenceCount( this IUnknown unknownObject )
22 unknownObject.AddReference();
24 catch( InvalidOperationException )
30 return unknownObject.Release();
37 /// 文字列が Null でも空でもないなら true を返す。
39 public static bool Nullでも空でもない( this string 検査対象 )
40 => !( string.IsNullOrEmpty( 検査対象 ) );
43 /// 文字列が Null または空なら true を返す。
45 public static bool Nullまたは空である( this string 検査対象 )
46 => string.IsNullOrEmpty( 検査対象 );
52 /// SharpDX.Size2F を System.Drawing.SizeF へ変換する。
54 public static System.Drawing.SizeF ToDrawingSizeF( this SharpDX.Size2F size )
55 => new System.Drawing.SizeF( size.Width, size.Height );
58 /// SharpDX.Size2F を System.Drawing.Size へ変換する。
60 public static System.Drawing.Size ToDrawingSize( this SharpDX.Size2F size )
61 => new System.Drawing.Size( (int) size.Width, (int) size.Height );
67 /// SharpDX.Size2 を System.Drawing.SizeF へ変換する。
69 public static System.Drawing.SizeF ToDrawingSizeF( this SharpDX.Size2 size )
70 => new System.Drawing.SizeF( size.Width, size.Height );
73 /// SharpDX.Size2 を System.Drawing.Size へ変換する。
75 public static System.Drawing.Size ToDrawingSize( this SharpDX.Size2 size )
76 => new System.Drawing.Size( size.Width, size.Height );