private static unsafe void SetProperty(IAssemblyName nameObject, PropertyId propertyId, string data) { if (data == null) { nameObject.SetProperty(propertyId, null, 0); } else { Debug.Assert(data.IndexOf('\0') == -1); fixed(char *p = data) { Debug.Assert(p[data.Length] == '\0'); // size is in bytes, include trailing \0 character: nameObject.SetProperty(propertyId, p, (uint)(data.Length + 1) * 2); } } }
private static unsafe void SetPublicKeyToken(IAssemblyName nameObject, byte[] value) { // An empty public key token is set via NULL_PUBLIC_KEY_TOKEN property. if (value != null && value.Length == 0) { nameObject.SetProperty(PropertyId.NULL_PUBLIC_KEY_TOKEN, null, 0); } else { SetProperty(nameObject, PropertyId.PUBLIC_KEY_TOKEN, value); } }
private static unsafe void SetProperty(IAssemblyName nameObject, PropertyId propertyId, uint data) { nameObject.SetProperty(propertyId, &data, sizeof(uint)); }
private static unsafe void SetPublicKeyToken(IAssemblyName nameObject, byte[] value) { // An empty public key token is set via NULL_PUBLIC_KEY_TOKEN property. if (value != null && value.Length == 0) { nameObject.SetProperty(PropertyId.NULL_PUBLIC_KEY_TOKEN, null, 0); } else { SetProperty(nameObject, PropertyId.PUBLIC_KEY_TOKEN, value); } }
private static unsafe void SetProperty(IAssemblyName nameObject, PropertyId propertyId, uint data) { nameObject.SetProperty(propertyId, &data, sizeof(uint)); }
private static unsafe void SetProperty(IAssemblyName nameObject, PropertyId propertyId, byte[] data) { if (data == null) { nameObject.SetProperty(propertyId, null, 0); } else { fixed (byte* p = data) { nameObject.SetProperty(propertyId, p, (uint)data.Length); } } }
private static unsafe void SetProperty(IAssemblyName nameObject, PropertyId propertyId, string data) { if (data == null) { nameObject.SetProperty(propertyId, null, 0); } else { Debug.Assert(data.IndexOf('\0') == -1); fixed (char* p = data) { Debug.Assert(p[data.Length] == '\0'); // size is in bytes, include trailing \0 character: nameObject.SetProperty(propertyId, p, (uint)(data.Length + 1) * 2); } } }