当前位置: 首页>>代码示例>>C#>>正文


C# Nullable类代码示例

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


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

示例14: Index

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="row">Row index.</param>
 /// <param name="col">Column index.</param>
 /// <param name="nDem">DEM list index.</param>
 public Index(int row, int col, Dem dem)
 {
     this.col = col;
     this.row = row;
     this.dem = dem;
     this.alt = null;
 }
开发者ID:KAW0,项目名称:Alter-Native,代码行数:13,代码来源:Index.cs

示例15: SetDefaultValues

 /// <summary>
 /// Sets the optional default values.
 /// </summary>
 /// <param name="shouldSet">if set to <c>true</c>, optional default values will be set.</param>
 public void SetDefaultValues(bool shouldSet)
 {
     if (shouldSet)
     {
         if (!this._isOverride.HasValue) this._isOverride = false;
     }
 }
开发者ID:snd-sweden,项目名称:DDI-API,代码行数:11,代码来源:GeneralInstructionType.cs


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