/[xmltv_parser]/trunk/libxmltv/Core/Internals.cs
ViewVC logotype

Contents of /trunk/libxmltv/Core/Internals.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22 - (show annotations) (download)
Thu Mar 7 10:20:50 2013 UTC (7 years, 7 months ago) by william
File size: 849 byte(s)

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5
6 namespace libxmltv.Core
7 {
8 internal static class Internals
9 {
10 internal static bool VerifyInstance<T>(object xmltv, out T t) where T : class
11 {
12 try
13 {
14 t = null;
15 if (xmltv == null) { return false; }
16 t = (xmltv as T);
17 if (t == null) { throw new InvalidCastException(string.Format("Unable to cast type: {0} to {1}", xmltv.GetType().Name, typeof(T).Name)); }
18 else { return true; }
19 }
20 catch (Exception ex)
21 {
22 throw new InvalidCastException(string.Format("Unable to cast type: {0} to {1}", xmltv.GetType().Name, typeof(T).Name), ex);
23 }
24 }
25 }
26 }

  ViewVC Help
Powered by ViewVC 1.1.22