예제 #1
0
        public MediaReference DeepCloneWithMediaReferenceKind(MediaReferenceKind mediaReferenceKind)
        {
            var result = new MediaReference(
                this.Url?.DeepClone(),
                mediaReferenceKind,
                this.Name?.DeepClone());

            return(result);
        }
        public MediaReference(
            string url,
            MediaReferenceKind mediaReferenceKind,
            string name = null)
        {
            if (url == null)
            {
                throw new ArgumentNullException(nameof(url));
            }

            if (string.IsNullOrWhiteSpace(url))
            {
                throw new ArgumentException(Invariant($"{nameof(url)} is white space."));
            }

            if (mediaReferenceKind == MediaReferenceKind.Unknown)
            {
                throw new ArgumentOutOfRangeException(Invariant($"{nameof(mediaReferenceKind)} is {nameof(MediaReferenceKind.Unknown)}."));
            }

            this.Url = url;
            this.MediaReferenceKind = mediaReferenceKind;
            this.Name = name;
        }