• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UnmanagedType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnmanagedType的典型用法代码示例。如果您正苦于以下问题:C# UnmanagedType类的具体用法?C# UnmanagedType怎么用?C# UnmanagedType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnmanagedType类属于命名空间,在下文中一共展示了UnmanagedType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UnmanagedMarshal

 private UnmanagedMarshal(UnmanagedType unmanagedType, Guid guid, int numElem, UnmanagedType type)
 {
     this.m_unmanagedType = unmanagedType;
     this.m_guid = guid;
     this.m_numElem = numElem;
     this.m_baseType = type;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:UnmanagedMarshal.cs


示例2: DefineUnmanagedMarshal

 public static UnmanagedMarshal DefineUnmanagedMarshal(UnmanagedType unmanagedType)
 {
     if (((unmanagedType == UnmanagedType.ByValTStr) || (unmanagedType == UnmanagedType.SafeArray)) || (((unmanagedType == UnmanagedType.CustomMarshaler) || (unmanagedType == UnmanagedType.ByValArray)) || (unmanagedType == UnmanagedType.LPArray)))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_NotASimpleNativeType"));
     }
     return new UnmanagedMarshal(unmanagedType, Guid.Empty, 0, (UnmanagedType) 0);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:UnmanagedMarshal.cs


示例3: Main

	public static int Main ()
	{
		UnmanagedType = (UnmanagedType) 0;

		if (UnmanagedType != 0)
			return 1;

		return 0;
	}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:test-85.cs


示例4: GetMarshalAsAttribute

        private static CustomAttributeBuilder GetMarshalAsAttribute(UnmanagedType unmanagedType)
        {
            Type[] ctorParams = new Type[] { typeof(UnmanagedType) };
            ConstructorInfo classCtorInfo = typeof(MarshalAsAttribute).GetConstructor(ctorParams);

            CustomAttributeBuilder builder = new CustomAttributeBuilder(
                                classCtorInfo,
                                new object[] { unmanagedType });
            return builder;
        }
开发者ID:Ryknyk,项目名称:ExcelDna,代码行数:10,代码来源:XlParameterInfo.cs


示例5: GetMarshalAs

 internal static void GetMarshalAs(ConstArray nativeType, out UnmanagedType unmanagedType, out VarEnum safeArraySubType, out string safeArrayUserDefinedSubType, out UnmanagedType arraySubType, out int sizeParamIndex, out int sizeConst, out string marshalType, out string marshalCookie, out int iidParamIndex)
 {
     int num;
     int num2;
     int num3;
     _GetMarshalAs(nativeType.Signature, nativeType.Length, out num, out num2, out safeArrayUserDefinedSubType, out num3, out sizeParamIndex, out sizeConst, out marshalType, out marshalCookie, out iidParamIndex);
     unmanagedType = (UnmanagedType) num;
     safeArraySubType = (VarEnum) num2;
     arraySubType = (UnmanagedType) num3;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:MetadataImport.cs


示例6: DefineUnmanagedMarshal

        /******************************
[System.Runtime.InteropServices.ComVisible(true)]
        * public static constructors. You can only construct
        * UnmanagedMarshal using these static constructors. 
        ******************************/
        public static UnmanagedMarshal DefineUnmanagedMarshal(UnmanagedType unmanagedType) 
        { 
            if (unmanagedType == UnmanagedType.ByValTStr ||
#if FEATURE_COMINTEROP 
                unmanagedType == UnmanagedType.SafeArray ||
                unmanagedType == UnmanagedType.CustomMarshaler ||
#endif //FEATURE_COMINTEROP
                unmanagedType == UnmanagedType.ByValArray || 
                unmanagedType == UnmanagedType.LPArray)
            { 
                // not a simple native marshal 
                throw new ArgumentException(Environment.GetResourceString("Argument_NotASimpleNativeType"));
            } 
            return new UnmanagedMarshal(unmanagedType, Guid.Empty, 0, (UnmanagedType) 0);
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:20,代码来源:UnmanagedMarshal.cs


示例7: Verify

    private int Verify(UnmanagedType umt, int expectedValue)
    {
        Console.WriteLine("Verify " + umt);
        try
        {
            if (expectedValue == (int)umt)
                return 0;

            Console.WriteLine("Error! Actual: {0}, Expected: {1}", (int)umt, expectedValue);
        }
        catch (Exception e)
        {
            Console.WriteLine("UnexpectedEception: " + e);
        }
        return 1;
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:16,代码来源:unmanagedtype.cs


示例8: GetUnmanagedType

		public static Type GetUnmanagedType(UnmanagedType type)
		{
			switch (type)
			{
				case UnmanagedType.I1: return typeof(bool);
				case UnmanagedType.U1: return typeof(bool);
				case UnmanagedType.I2: return typeof(short);
				case UnmanagedType.I4: return typeof(int);
				case UnmanagedType.I8: return typeof(long);
				case UnmanagedType.R4: return typeof(float);
				case UnmanagedType.R8: return typeof(double);
				case UnmanagedType.Currency: return typeof(double);
				case UnmanagedType.ByValTStr: return typeof(char);
				default: throw new NotImplementedException();
			}
		}
开发者ID:mjacezar,项目名称:ACBrFramework,代码行数:16,代码来源:DefExporter.cs


示例9: DefineSafeArray

 public static UnmanagedMarshal DefineSafeArray(UnmanagedType elemType)
 {
     return new UnmanagedMarshal(UnmanagedType.SafeArray, Guid.Empty, 0, elemType);
 }
开发者ID:kouvel,项目名称:coreclr,代码行数:4,代码来源:UnmanagedMarshal.cs


示例10: GetMarshalAs

        [System.Security.SecurityCritical]  // auto-generated
        internal static void GetMarshalAs(ConstArray nativeType, 
            out UnmanagedType unmanagedType, out VarEnum safeArraySubType, out string safeArrayUserDefinedSubType, 
            out UnmanagedType arraySubType, out int sizeParamIndex, out int sizeConst, out string marshalType, out string marshalCookie,
            out int iidParamIndex)
        {
            int _unmanagedType, _safeArraySubType, _arraySubType;

            _GetMarshalAs(nativeType.Signature, (int)nativeType.Length,
                out _unmanagedType, out _safeArraySubType, out safeArrayUserDefinedSubType, 
                out _arraySubType, out sizeParamIndex, out sizeConst, out marshalType, out marshalCookie,
                out iidParamIndex);
            unmanagedType = (UnmanagedType)_unmanagedType;
            safeArraySubType = (VarEnum)_safeArraySubType;
            arraySubType = (UnmanagedType)_arraySubType;
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:16,代码来源:mdimport.cs


示例11: UnmanagedMarshal

	// Define a simple unmanaged marshalling behaviour.
	public static UnmanagedMarshal DefineUnmanagedMarshal
				(UnmanagedType unmanagedType)
			{
				// Must be a simple unmanaged type.
				if(unmanagedType == UnmanagedType.ByValArray ||
				   unmanagedType == UnmanagedType.ByValTStr ||
				   unmanagedType == UnmanagedType.LPArray ||
				   unmanagedType == UnmanagedType.SafeArray ||
				   unmanagedType == UnmanagedType.CustomMarshaler)
				{
					throw new ArgumentException
						(_("Emit_NotSimpleUnmanagedType"));
				}
				return new UnmanagedMarshal(unmanagedType);
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:16,代码来源:UnmanagedMarshal.cs


示例12: UnmanagedMarshal

#pragma warning restore 169, 414
		
		private UnmanagedMarshal (UnmanagedType maint, int cnt) {
			count = cnt;
			t = maint;
			tbase = maint;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:7,代码来源:UnmanagedMarshal.cs


示例13: DefineLPArray

		public static UnmanagedMarshal DefineLPArray( UnmanagedType elemType) {
			return new UnmanagedMarshal (UnmanagedType.LPArray, elemType);
		}
开发者ID:runefs,项目名称:Marvin,代码行数:3,代码来源:UnmanagedMarshal.cs


示例14: GetTypeNameForUnmanagedType

 public static TypeName GetTypeNameForUnmanagedType(UnmanagedType unmngType)
 {
     return primitiveUnmanagedToNameMap[(int)unmngType];
 }
开发者ID:dbremner,项目名称:clrinterop,代码行数:4,代码来源:Tables.cs


示例15: MarshalingToCharSet

            private static CharSet? MarshalingToCharSet(UnmanagedType? type)
            {
                if (type == null)
                {
                    return null;
                }

                switch (type)
                {
                    case UnmanagedType.AnsiBStr:
                    case UnmanagedType.LPStr:
                    case UnmanagedType.VBByRefStr:
                        return CharSet.Ansi;
                    case UnmanagedType.BStr:
                    case UnmanagedType.LPWStr:
                        return CharSet.Unicode;
                    case UnmanagedType.ByValTStr:
                    case UnmanagedType.LPTStr:
                    case UnmanagedType.TBStr:
                        return CharSet.Auto;
                    default:
                        return CharSet.None;
                }
            }
开发者ID:riversky,项目名称:roslyn,代码行数:24,代码来源:PInvokeDiagnosticAnalyzer.cs


示例16: DefineUnmanagedMarshal

		public static UnmanagedMarshal DefineUnmanagedMarshal( UnmanagedType unmanagedType) {
			return new UnmanagedMarshal (unmanagedType, unmanagedType);
		}
开发者ID:runefs,项目名称:Marvin,代码行数:3,代码来源:UnmanagedMarshal.cs


示例17: MarshalAsAttribute

 internal MarshalAsAttribute(UnmanagedType val, VarEnum safeArraySubType, RuntimeType safeArrayUserDefinedSubType, UnmanagedType arraySubType,
     short sizeParamIndex, int sizeConst, string marshalType, RuntimeType marshalTypeRef, string marshalCookie, int iidParamIndex)
 {
     _val = val;
     SafeArraySubType = safeArraySubType;
     SafeArrayUserDefinedSubType = safeArrayUserDefinedSubType;
     IidParameterIndex = iidParamIndex;
     ArraySubType = arraySubType;
     SizeParamIndex = sizeParamIndex;
     SizeConst = sizeConst;
     MarshalType = marshalType;
     MarshalTypeRef = marshalTypeRef;
     MarshalCookie = marshalCookie;
 }
开发者ID:razzfazz,项目名称:mono,代码行数:14,代码来源:attributes.cs


示例18: DefineLPArrayInternal

		// sizeConst and sizeParamIndex can be -1 meaning they are not specified
		internal static UnmanagedMarshal DefineLPArrayInternal (UnmanagedType elemType, int sizeConst, int sizeParamIndex) {
			UnmanagedMarshal res = new UnmanagedMarshal (UnmanagedType.LPArray, elemType);
			res.count = sizeConst;
			res.param_num = sizeParamIndex;
			res.has_size = true;

			return res;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:9,代码来源:UnmanagedMarshal.cs


示例19: MarshalAsAttribute

 public MarshalAsAttribute(UnmanagedType unmanagedType)
 {
 }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:3,代码来源:Core.cs


示例20: MarshalingToCharSet

            private static CharSet? MarshalingToCharSet(UnmanagedType? type)
            {
                if (type == null)
                {
                    return null;
                }

                switch (type)
                {
                    case UnmanagedType.AnsiBStr:
                    case UnmanagedType.LPStr:
                    case UnmanagedType.VBByRefStr:
                        return CharSet.Ansi;
                    case UnmanagedType.BStr:
                    case UnmanagedType.LPWStr:
                        return CharSet.Unicode;
                    case UnmanagedType.ByValTStr:
                    case UnmanagedType.LPTStr:
                    case UnmanagedType.TBStr:
                    default:
                        // CharSet.Auto and CharSet.None are not available in the portable
                        // profiles. We are not interested in those values for our analysis and so simply
                        // return null
                        return null;
                }
            }
开发者ID:hanin,项目名称:roslyn-analyzers,代码行数:26,代码来源:PInvokeDiagnosticAnalyzer.cs



注:本文中的UnmanagedType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnmarshallerContext类代码示例发布时间:2022-05-24
下一篇:
C# UnmanagedImage类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap