InAttribute Class
Indicates that data should be marshaled from the caller to the callee, but not back to the caller.
For a list of all members of this type, see InAttribute Members.
System.Object
System.Attribute
System.Runtime.InteropServices.InAttribute
[Visual Basic] <AttributeUsage(AttributeTargets.Parameter)> NotInheritable Public Class InAttribute Inherits Attribute [C#] [AttributeUsage(AttributeTargets.Parameter)] public sealed class InAttribute : Attribute [C++] [AttributeUsage(AttributeTargets::Parameter)] public __gc __sealed class InAttribute : public Attribute [JScript] public AttributeUsage(AttributeTargets.Parameter) class InAttribute extends Attribute
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
You can apply this attribute to parameters.
The InAttribute is optional. The attribute is supported for COM interop and platform invoke only. In the absence of explicit settings, the interop marshaler assumes rules based on the parameter type, whether the parameter is passed by reference or by value, and whether the type is blittable or non-blittable. For example, the StringBuilder class is always assumed to be In/Out and an array of strings passed by value is assumed to be In.
You cannot apply the InAttribute to a parameter modified with the C#-styled out keyword. To avoid confusing the In keyword in Visual Basic with the InAttribute, minus Attribute, use the <[In]> form with brackets around the attribute.
Combining the InAttribute and OutAttribute is particularly useful when applied to arrays and formatted, non-blittable types. Callers see the changes a callee makes to these types only when you apply both attributes. Since these types require copying during marshaling, you can use InAttribute and OutAttribute to reduce unnecessary copies.
For more information on the effect of InAttribute on marshaling behavior, see Directional Attributes.
Requirements
Namespace: System.Runtime.InteropServices
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: Mscorlib (in Mscorlib.dll)
See Also
InAttribute Members | System.Runtime.InteropServices Namespace | OutAttribute | StringBuilder | Blittable and Non-Blittable Types