• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Nullable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Nullable的典型用法代码示例。如果您正苦于以下问题:C# Nullable类的具体用法?C# Nullable怎么用?C# Nullable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Nullable类属于命名空间,在下文中一共展示了Nullable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Doctor_Hospital_Search

 public Doctor_Hospital_Search(Nullable<int> doctorId, string doctorName, Nullable<int> genderId, string gender, Nullable<int> specialistFieldId, string specialistField, 
                       Nullable<int> subSpecialistFieldId, string subSpecialistField, Nullable<int> specialPracticeId, Nullable<int> specialPractice,
                       Nullable<int> countryId, string country, Nullable<int> cityId, string city, string countryOfSpecializedDegree, 
                       Nullable<int> countryOfSpecializedDegreeId, string specializedExperience, Nullable<int> countryOfPostGraduateExperienceId, 
                       string countryOfPostGraduateExperience, Nullable<int> hospitalId, string hospital, Nullable<int> departmentId, string department)
 {
     this.DoctorId = doctorId;
       this.DoctorName = doctorName;
       this.GenderId = genderId;
       this.Gender = gender;
       this.SpecialistFieldId = specialistFieldId;
       this.SpecialistField = specialistField;
       this.SubSpecialistFieldId = subSpecialistFieldId;
       this.SubSpecialistField = subSpecialistField;
       this.SpecialPracticeId = specialPracticeId;
       this.SpecialPractice = specialPractice;
       this.CountryId = countryId;
       this.Country = country;
       this.CityId = cityId;
       this.City = city;
       this.CountryOfSpecializedDegreeId = countryOfSpecializedDegreeId;
       this.CountryOfSpecializedDegree = countryOfSpecializedDegree;
       this.SpecializedExperience = specializedExperience;
       this.CountryOfPostGraduateExperienceId = countryOfPostGraduateExperienceId;
       this.CountryOfPostGraduateExperience = countryOfPostGraduateExperience;
       this.HospitalId = hospitalId;
       this.Hospital = hospital;
       this.DepartmentId = departmentId;
       this.Department = department;
 }
开发者ID:nextech,项目名称:caretech,代码行数:30,代码来源:Search.cs


示例2: TweetPublished

 public ActionResult TweetPublished(Nullable<long> id, string actionPerformed, bool success = true)
 {
     ViewBag.TweetId = id;
     ViewBag.ActionType = actionPerformed;
     ViewBag.Success = success;
     return View();
 }
开发者ID:SowaLabs,项目名称:TweetinviNew,代码行数:7,代码来源:TweetController.cs


示例3: Scrollbar

        public Scrollbar ( string name, Vector2 position, Axis axis, Nullable<int> width, Nullable<int> height, int max, int value )//, Style style)
        {
            this.Type = ControlType.Scrollbar;
            this.name = name;
            this.position = position;
            this.axis = axis;
            //this.style = style;

            this.min = 0;
            this.max = max;
            this.value = value;

            switch (axis)
            {
                case Axis.Horizontal:
                    if (width.HasValue)
                        size.X = width.Value;
                    break;
                case Axis.Vertical:
                    if (height.HasValue)
                        size.Y = height.Value;
                    break;
            }

            Init();

            scrollUp.OnMousePress += new EventHandler( On_ScrollUp );
            scrollDown.OnMousePress += new EventHandler( On_ScrollDown );
            OnValueChange += new EventHandler( onValueChange );
        }
开发者ID:ingex0,项目名称:smarttank,代码行数:30,代码来源:Scrollbar.cs


示例4: AddData

        // CRUD FUNCTION
        // ADD NEW ITEM USING AJAX
        public int AddData(string Name, Nullable<int> UOM, string Remarks, string BarCode,
            Nullable<bool> WithSerial, Nullable<int> Reorder, string Code, Nullable<int> G230, Nullable<int> G233, Nullable<int> G234, 
            string Model)
        {
            var allItem = from m in db.PDs select m;
            if (allItem.Any(c => c.Name.ToLower().Equals(Name.ToLower())))
            {
                Response.Write("Item with the name '" + Name + "' already exists");
                Response.StatusCode = 404;
                Response.End();
                return -1;
            }

            var pushPDS = new PD();
            pushPDS.Name = Name;
            pushPDS.UOM = UOM;
            pushPDS.Remarks = Remarks;
            pushPDS.BarCode = BarCode;
            pushPDS.WithSerial = WithSerial;
            pushPDS.Reorder = Reorder;
            pushPDS.Code = Code;
            pushPDS.G230 = G230;
            pushPDS.G233 = G233;
            pushPDS.G234 = G234;
            pushPDS.Model = Model;

            db.PDs.InsertOnSubmit(pushPDS);
            db.SubmitChanges();

            //Response.End();
            return pushPDS.ID;
        }
开发者ID:gunbladeiv,项目名称:MVC-3,代码行数:34,代码来源:ItemsController.cs


示例5: DrawRectangle

 /// <summary>Draws a rectangle.</summary>
 /// <param name="texture">The texture, or a null reference.</param>
 /// <param name="point">The top-left coordinates in pixels.</param>
 /// <param name="size">The size in pixels.</param>
 /// <param name="color">The color, or a null reference.</param>
 internal static void DrawRectangle(Textures.Texture texture, Point point, Size size, Nullable<Color128> color)
 {
     // TODO: Remove Nullable<T> from color once RenderOverlayTexture and RenderOverlaySolid are fully replaced.
     if (texture == null || !Textures.LoadTexture(texture, Textures.OpenGlTextureWrapMode.ClampClamp)) {
         Gl.glDisable(Gl.GL_TEXTURE_2D);
         if (color.HasValue) {
             Gl.glColor4d(color.Value.R, color.Value.G, color.Value.B, color.Value.A);
         }
         Gl.glBegin(Gl.GL_QUADS);
         Gl.glVertex2d(point.X, point.Y);
         Gl.glVertex2d(point.X + size.Width, point.Y);
         Gl.glVertex2d(point.X + size.Width, point.Y + size.Height);
         Gl.glVertex2d(point.X, point.Y + size.Height);
         Gl.glEnd();
     } else {
         Gl.glEnable(Gl.GL_TEXTURE_2D);
         Gl.glBindTexture(Gl.GL_TEXTURE_2D, texture.OpenGlTextures[(int)Textures.OpenGlTextureWrapMode.ClampClamp].Name);
         if (color.HasValue) {
             Gl.glColor4d(color.Value.R, color.Value.G, color.Value.B, color.Value.A);
         }
         Gl.glBegin(Gl.GL_QUADS);
         Gl.glTexCoord2f(0.0f, 0.0f);
         Gl.glVertex2d(point.X, point.Y);
         Gl.glTexCoord2f(1.0f, 0.0f);
         Gl.glVertex2d(point.X + size.Width, point.Y);
         Gl.glTexCoord2f(1.0f, 1.0f);
         Gl.glVertex2d(point.X + size.Width, point.Y + size.Height);
         Gl.glTexCoord2f(0.0f, 1.0f);
         Gl.glVertex2d(point.X, point.Y + size.Height);
         Gl.glEnd();
     }
 }
开发者ID:sladen,项目名称:openbve,代码行数:37,代码来源:Renderer.Primitives.cs


示例6: Crear

        public string Crear(string p_id, Nullable<DateTime> p_fecha, PalmeralGenNHibernate.Enumerated.Default_.EstadoPedidoEnum p_estado, PalmeralGenNHibernate.Enumerated.Default_.TipoPagoEnum p_tipoPago, System.Collections.Generic.IList<PalmeralGenNHibernate.EN.Default_.LineaPedidoEN> p_lineas, string p_proveedor)
        {
            PedidoEN pedidoEN = null;
            string oid;

            //Initialized PedidoEN
            pedidoEN = new PedidoEN ();
            pedidoEN.Id = p_id;

            pedidoEN.Fecha = p_fecha;

            pedidoEN.Estado = p_estado;

            pedidoEN.TipoPago = p_tipoPago;

            pedidoEN.Lineas = p_lineas;

            if (p_proveedor != null) {
                pedidoEN.Proveedor = new PalmeralGenNHibernate.EN.Default_.ProveedorEN ();
                pedidoEN.Proveedor.Id = p_proveedor;
            }

            //Call to PedidoCAD

            oid = _IPedidoCAD.Crear (pedidoEN);
            return oid;
        }
开发者ID:pablovargan,项目名称:winforms-ooh4ria,代码行数:27,代码来源:PedidoCEN.cs


示例7: ConvertDateTimeToTimeSpan

 public static long ConvertDateTimeToTimeSpan(Nullable<DateTime> dt)
 {
     if (dt == null) return 0; 
     TimeSpan ts = dt.Value.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);  
     long timeSpan = Convert.ToInt64(ts.TotalMilliseconds);
     return timeSpan;
 }
开发者ID:xtanuiha,项目名称:Worktile-For-WP8.1,代码行数:7,代码来源:Utils.cs


示例8: Normalize

 public static Rectangle Normalize(Rectangle rect, Vector2 pos, Vector2 origin, Nullable<Rectangle> sourceRectangle )
 {
     return new Rectangle(rect.X - (int)pos.X + sourceRectangle.Value.X + (int)origin.X,
                          rect.Y - (int)pos.Y + sourceRectangle.Value.Y + (int)origin.Y,
                          rect.Width,
                          rect.Height);
 }
开发者ID:Jakob37,项目名称:JDGAME,代码行数:7,代码来源:CollisionDetection.cs


示例9: PosTest1

    public bool PosTest1()
    {
        bool retVal = true;

        const string c_TEST_DESC = "PosTest1: Verify the Nullable object's HasValue is true";
        const string c_TEST_ID = "P001";

        int value = TestLibrary.Generator.GetInt32(-55);
        int? nullObj = new Nullable<int>(value);

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            if (!nullObj.HasValue)
            {
                string errorDesc = "value is not true as expected: Actual(false)";
                errorDesc += "\n value is " + value;
                TestLibrary.TestFramework.LogError("001 " + "TestID_" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002 " + "TestID_" + c_TEST_ID, "Unexpected exception: " + e + "\n value is " + value);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:31,代码来源:nullablehasvalue.cs


示例10: PosTest2

    public bool PosTest2()
    {
        bool retVal = true;

        const string c_TEST_DESC = "PosTest2: Verify the Nullable object's HasValue is false";
        const string c_TEST_ID = "P002";

        int? nullObj = new Nullable<int>();

        TestLibrary.TestFramework.BeginScenario(c_TEST_DESC);

        try
        {
            if (nullObj.HasValue)
            {
                string errorDesc = "value is not false as expected: Actual(true)";
                TestLibrary.TestFramework.LogError("003 " + "TestID_" + c_TEST_ID, errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004 " + "TestID_" + c_TEST_ID, "Unexpected exception: " + e );
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return retVal;
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:29,代码来源:nullablehasvalue.cs


示例11: AddNew

        public int AddNew(Guid PageGuid, string MetaKeywords, string MetaDesc, string Title, string ContentHtml, string TemplatePath, string ReleasePath, int Hits, Nullable<DateTime> DateCreated)
        {
            DbCommand command = DbProviderHelper.CreateCommand("INSERTPage",CommandType.StoredProcedure);
            command.Parameters.Add(DbProviderHelper.CreateParameter("@PageGuid",DbType.Guid,PageGuid));
            if (MetaKeywords!=null)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaKeywords",DbType.String,MetaKeywords));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaKeywords",DbType.String,DBNull.Value));
            if (MetaDesc!=null)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaDesc",DbType.String,MetaDesc));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@MetaDesc",DbType.String,DBNull.Value));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@Title",DbType.String,Title));
            if (ContentHtml!=null)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@ContentHtml",DbType.String,ContentHtml));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@ContentHtml",DbType.String,DBNull.Value));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@TemplatePath",DbType.String,TemplatePath));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@ReleasePath",DbType.String,ReleasePath));
            command.Parameters.Add(DbProviderHelper.CreateParameter("@Hits",DbType.Int32,Hits));
            if (DateCreated.HasValue)
                command.Parameters.Add(DbProviderHelper.CreateParameter("@DateCreated",DbType.DateTime,DateCreated));
            else
                command.Parameters.Add(DbProviderHelper.CreateParameter("@DateCreated",DbType.DateTime,DBNull.Value));

            return Convert.ToInt32(DbProviderHelper.ExecuteScalar(command));
        }
开发者ID:htawab,项目名称:wiscms,代码行数:27,代码来源:PageManager.cs


示例12: CrearSolicitud

        public int CrearSolicitud(string p_solicitante, TravelnookGenNHibernate.Enumerated.Travelnook.EstadoSolicitudEnum p_estado, Nullable<DateTime> p_fecha, string p_solicitado)
        {
            SolicitudEN solicitudEN = null;
            int oid;

            //Initialized SolicitudEN
            solicitudEN = new SolicitudEN ();

            if (p_solicitante != null) {
                // El argumento p_solicitante -> Property solicitante es oid = false
                // Lista de oids id
                solicitudEN.Solicitante = new TravelnookGenNHibernate.EN.Travelnook.UsuarioEN ();
                solicitudEN.Solicitante.NomUsu = p_solicitante;
            }

            solicitudEN.Estado = p_estado;

            solicitudEN.Fecha = p_fecha;

            if (p_solicitado != null) {
                // El argumento p_solicitado -> Property solicitado es oid = false
                // Lista de oids id
                solicitudEN.Solicitado = new TravelnookGenNHibernate.EN.Travelnook.UsuarioEN ();
                solicitudEN.Solicitado.NomUsu = p_solicitado;
            }

            //Call to SolicitudCAD

            oid = _ISolicitudCAD.CrearSolicitud (solicitudEN);
            return oid;
        }
开发者ID:chespii12,项目名称:DSM_Travelnook,代码行数:31,代码来源:SolicitudCEN.cs


示例13: InsertCourse

     public virtual int InsertCourse(Nullable<int> authorID, string title, string description, Nullable<short> price, string levelString, Nullable<byte> level)
     {
         var authorIDParameter = authorID.HasValue ?
             new ObjectParameter("AuthorID", authorID) :
             new ObjectParameter("AuthorID", typeof(int));
 
         var titleParameter = title != null ?
             new ObjectParameter("Title", title) :
             new ObjectParameter("Title", typeof(string));
 
         var descriptionParameter = description != null ?
             new ObjectParameter("Description", description) :
             new ObjectParameter("Description", typeof(string));
 
         var priceParameter = price.HasValue ?
             new ObjectParameter("Price", price) :
             new ObjectParameter("Price", typeof(short));
 
         var levelStringParameter = levelString != null ?
             new ObjectParameter("LevelString", levelString) :
             new ObjectParameter("LevelString", typeof(string));
 
         var levelParameter = level.HasValue ?
             new ObjectParameter("Level", level) :
             new ObjectParameter("Level", typeof(byte));
 
         return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("InsertCourse", authorIDParameter, titleParameter, descriptionParameter, priceParameter, levelStringParameter, levelParameter);
     }
开发者ID:aeoluseros,项目名称:WCFWPF,代码行数:28,代码来源:PlutoModel.Context.cs


示例14: SelectGimnasticarUcesnikForm

        public SelectGimnasticarUcesnikForm(int takmicenjeId, Nullable<Pol> pol,
            TakmicarskaKategorija kategorija)
        {
            InitializeComponent();
            Text = "Izaberi gimnasticara";

            this.takmicenjeId = takmicenjeId;
            this.gimnastika = null;
            if (pol != null)
            {
                if (pol == Pol.Muski)
                    gimnastika = Gimnastika.MSG;
                else if (pol == Pol.Zenski)
                    gimnastika = Gimnastika.ZSG;
            }
            this.kategorija = kategorija;
            initializeGridColumns();

            DataGridViewUserControl.GridColumnHeaderMouseClick += new EventHandler<GridColumnHeaderMouseClickEventArgs>(DataGridViewUserControl_GridColumnHeaderMouseClick);

            FetchModes.Add(new AssociationFetch(
                "Takmicenje", AssociationFetchMode.Eager));
            FetchModes.Add(new AssociationFetch(
                "TakmicarskaKategorija", AssociationFetchMode.Eager));
            FetchModes.Add(new AssociationFetch(
                "KlubUcesnik", AssociationFetchMode.Eager));
            FetchModes.Add(new AssociationFetch(
                "DrzavaUcesnik", AssociationFetchMode.Eager));

            this.ClientSize = new Size(800, 450);

            showAll();
        }
开发者ID:stankela,项目名称:bilten,代码行数:33,代码来源:SelectGimnasticarUcesnikForm.cs


示例15: Initialize

        //Initialize
        public void Initialize(Texture2D texture, Vector2 position)
        {
            //Initialize
            PlayerTexture = texture;
            Position = position;
            Heading = 0.0f;

            //Sensor Data
            enemyData = new List<EnemyData>();
            walls = new List<BoundingBox>();

            //Number of Rays to be cast
            rayCount = 5;
            rayDist = new Nullable<float>[rayCount];
            rayList = new Vector2[rayCount];

            //Number of Quadrants
            quadrants = new int[4];

            //Max Values
            FirstRay = new Vector2(0, -1);
            //FirstRay.Normalize();

            rayMax = 250;
            agentMax = 500;
            pieMax = 150;

            //ACTIVATE
            Active = true;
        }
开发者ID:DrDenn,项目名称:XNA_AI_Project,代码行数:31,代码来源:Player.cs


示例16: AdjustResultForIntersectionWithSide

        private static void AdjustResultForIntersectionWithSide( ref Nullable<Point> result, ref double distance, Segment intersection, Point point )
        {
            if( !intersection.IsEmpty )
              {
            if( intersection.Contains( point ) )
            {
              distance = 0;
              result = point;
              return;
            }

            double p1Distance = PointHelper.DistanceBetween( point, intersection.P1 );
            double p2Distance = double.PositiveInfinity;
            if( !intersection.IsPoint )
            {
              p2Distance = PointHelper.DistanceBetween( point, intersection.P2 );
            }

            if( Math.Min( p1Distance, p2Distance ) < distance )
            {
              if( p1Distance < p2Distance )
              {
            distance = p1Distance;
            result = intersection.P1;
              }
              else
              {
            distance = p2Distance;
            result = intersection.P2;
              }
            }
              }
        }
开发者ID:eolandezhang,项目名称:Diagram,代码行数:33,代码来源:RectHelper.cs


示例17: Main

        static void Main(string[] args)
        {
            int i = 3;
            long l = i;

            i = (int)l;

            //string s = "manuel";
            //i = (int)(object)s;

            int? n = null;
            if (n == null)
            {
                Console.WriteLine("n is een value type, maar wel degelijk null!?!?!?!");
            }

            Nullable<int> n2 = new Nullable<int>();
            if (!n2.HasValue)
            {
                Console.WriteLine("Oh, zo werkt dat dus!");
            }
            else
            {
                Console.WriteLine(n2.Value);
            }
        }
开发者ID:riezebosch,项目名称:cnetin1,代码行数:26,代码来源:Program.cs


示例18: CDPShape

 public CDPShape(Nullable<Color> penColor, Nullable<Color> fillColor, double penWidth, Point referencePoint)
 {
     this.penColor = penColor;
     this.fillColor = fillColor;
     this.penWidth = penWidth;
     this.referencePoint = referencePoint;
 }
开发者ID:davidbedok,项目名称:oeprogvep,代码行数:7,代码来源:CDPShape.cs


示例19: TextFileAppender

        /// <summary>
        /// Constructeur
        /// </summary>
        /// <param name="InName">Nom de l'appender</param>
        /// <param name="InLogFile"> Nom du fichier de log (avec chemin)</param>
        public TextFileAppender(string InName, string InLogFile = "", Nullable<LogLevel> SpecifiLogLevel = null)
            : base(InName,SpecifiLogLevel)
        {

            LogFile = InLogFile;

        }// end constructeur
开发者ID:gerald13,项目名称:NSLog,代码行数:12,代码来源:TextFileAppender.cs


示例20: FacebookLogin

 public void FacebookLogin()
 {
     fbWebContext = FacebookWebContext.Current; //get facebook session
     if (FacebookWebContext.Current.Session != null)
     {
         var app = new FacebookWebClient();
         var me = (IDictionary<string, object>)app.Get("me");   // get own information
         _FacebookUid = fbWebContext.UserId ;                // get own user id
         try
         {
             string fbName = (string)me["first_name"] + " " + (string)me["last_name"]; // get first name and last name
             if (OnFacebookLogin(fbName))
             {
                 SaveSessionInDB();
                 return;
             }
             else
             {
                 string notice = string.Format("<h2>Welcome, {0}.</h2>" +
                     "<h3>Login here to connect your Facebook login to your account<br/>" +
                     "Or sign-up to create full account, connected with your Facebook credentials</h3>", fbName);
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
开发者ID:rupendra-sharma07,项目名称:MainTrunk,代码行数:28,代码来源:PostMessage.ascx.cs



注:本文中的Nullable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Number类代码示例发布时间:2022-05-24
下一篇:
C# NsNode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap