Org.BouncyCastle.Asn1.X509.NoticeReference.GetInstance C# (CSharp) Method

GetInstance() public static method

public static GetInstance ( object obj ) : NoticeReference
obj object
return NoticeReference
		public static NoticeReference GetInstance(
			object obj)
		{
			if (obj is NoticeReference)
			{
				return (NoticeReference) obj;
			}

			if (obj is Asn1Sequence)
			{
				return new NoticeReference((Asn1Sequence) obj);
			}

			throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj");
		}

Usage Example

Beispiel #1
0
 public UserNotice(
     Asn1Sequence seq)
 {
     if (seq.Count == 2)
     {
         noticeRef    = NoticeReference.GetInstance(seq[0]);
         explicitText = DisplayText.GetInstance(seq[1]);
     }
     else if (seq.Count == 1)
     {
         if (seq[0].ToAsn1Object() is Asn1Sequence)
         {
             noticeRef    = NoticeReference.GetInstance(seq[0]);
             explicitText = null;
         }
         else
         {
             noticeRef    = null;
             explicitText = DisplayText.GetInstance(seq[0]);
         }
     }
     else if (seq.Count == 0)
     {
         noticeRef    = null;    // neither field set!
         explicitText = null;
     }
     else
     {
         throw new ArgumentException("Bad sequence size: " + seq.Count);
     }
 }
All Usage Examples Of Org.BouncyCastle.Asn1.X509.NoticeReference::GetInstance