English 中文(简体)
ReSharper可能作废。 我看不出,这怎么可能无效?
原标题:Possible null assignment in ReSharper. I can t see how that can be null?

我收到以下警告:

Possible null assignment to an entity marked with Value cannot be null attribute

My code:

if (verifier.GetType().GetInterface(typeof(IAsyncVerifier).FullName, true) == null)
                {
                    continue;
                }

在<代码>类型(IAsyncVerifier)上发出的警告。 这怎么可能无效? 你们将如何解决这个问题? 或者,如果物体实施特定接口,那么数据可能更好?

最佳回答

Or maybe there is better way to figure if object implements specific interface?

如果物体类型来自某一特定接口或类别,则由操作者进行检查。

if (verifier is IAsyncVerifier)

http://msdn.microsoft.com/en-us/library/system.打字。 类型: 它说,财产不会归还。

... Nothing if the current instance represents a generic type parameter, an array type, pointer type, or byref type based on a type parameter, or a generic type that is not a generic type definition but contains unresolved type parameters.

如果您能确信,如果您能全面查阅,这在任何情况下都不会无效,那么你就能够利用<条码>/可转让<<<>/>>/>条码/条码>发表这一警告。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签