PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Mono.Cecil/IMarshalInfoProvider.cs

http://github.com/jbevain/cecil
C# | 38 lines | 23 code | 6 blank | 9 comment | 1 complexity | fdf262e565d35c0a63aef9b3b40daecf MD5 | raw file
 1//
 2// Author:
 3//   Jb Evain (jbevain@gmail.com)
 4//
 5// Copyright (c) 2008 - 2015 Jb Evain
 6// Copyright (c) 2008 - 2011 Novell, Inc.
 7//
 8// Licensed under the MIT/X11 license.
 9//
10
11namespace Mono.Cecil {
12
13	public interface IMarshalInfoProvider : IMetadataTokenProvider {
14
15		bool HasMarshalInfo { get; }
16		MarshalInfo MarshalInfo { get; set; }
17	}
18
19	static partial class Mixin {
20
21		public static bool GetHasMarshalInfo (
22			this IMarshalInfoProvider self,
23			ModuleDefinition module)
24		{
25			return module.HasImage () && module.Read (self, (provider, reader) => reader.HasMarshalInfo (provider));
26		}
27
28		public static MarshalInfo GetMarshalInfo (
29			this IMarshalInfoProvider self,
30			ref MarshalInfo variable,
31			ModuleDefinition module)
32		{
33			return module.HasImage ()
34				? module.Read (ref variable, self, (provider, reader) => reader.ReadMarshalInfo (provider))
35				: null;
36		}
37	}
38}