Here are the examples of the csharp api class string.IsNullOrEmpty(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
11
1. Example
View licenseprivate async Task RunUpdate() { if (!string.IsNullOrEmpty(_path.Value())) /n ..... /n //View Source file for more details /n }
5
2. Example
View licenseprivate static ProjectReferenceNode GetProjectReferenceOnNodeForHierarchy(IList<ReferenceNode> references, IVsHierarchy inputHierarchy) { if(references == null) { return null; } Guid projectGuid; ErrorHandler.ThrowOnFailure(inputHierarchy.GetGuidProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectIDGuid, out projectGuid)); string canonicalName; ErrorHandler.ThrowOnFailure(inputHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out canonicalName)); foreach(ReferenceNode refNode in references) { ProjectReferenceNode projRefNode = refNode as ProjectReferenceNode; if(projRefNode != null) { if(projRefNode.ReferencedProjectGuid == projectGuid) { return projRefNode; } // Try with canonical names, if the project that is removed is an unloaded project than the above criteria will not pass. if(!String.IsNullOrEmpty(projRefNode.Url) && NativeMethods.IsSamePath(projRefNode.Url, canonicalName)) { return projRefNode; } } } return null; }
1
3. Example
View licenseprotected async Task<BoxFile> MoveFile(string fileId, string parentId, string etag = "") { var boxClient = base.ConfigureBoxClient(this._asUser.Value()); var fileRequest = this.ConfigureFileRequest(fileId, parentId); if (!string.IsNullOrEmpty(etag)) { return await boxClient.FilesManager.UpdateInformationAsync(fileRequest, etag); } else { return await boxClient.FilesManager.UpdateInformationAsync(fileRequest); } }
1
4. Example
View licenseprotected void CheckForFileVersionId(string id, CommandLineApplication app) { if (string.IsNullOrEmpty(id)) { app.ShowHelp(); throw new Exception("A file version ID is required for this command."); } }
1
5. Example
View licenseprivate BoxHomeDefaultSettings SetBoxDownloadsFolderPathIfNull(BoxHomeDefaultSettings settings) { if (string.IsNullOrEmpty(settings.BoxDownloadsFolderPath)) { var path = $"{_boxHome.GetBaseDirectoryPath()}{Path.DirectorySeparatorChar}Downloads{Path.DirectorySeparatorChar}{settings.BoxDownloadsFolderName}"; settings.BoxDownloadsFolderPath = path; } return settings; }
0
6. Example
View licenseprotected void CheckForFileId(string id, CommandLineApplication app) { if (string.IsNullOrEmpty(id)) { app.ShowHelp(); throw new Exception("A file ID is required for this command."); } }
0
7. Example
View licenseprotected virtual BoxClient ConfigureBoxClient(string oneCallAsUserId = null, bool returnSer/n ..... /n //View Source file for more details /n }
0
8. Example
View licenseprivate BoxHomeDefaultSettings SetBoxReportsFolderPathIfNull(BoxHomeDefaultSettings settings) { if (string.IsNullOrEmpty(settings.BoxReportsFolderPath)) { var path = $"{_boxHome.GetBaseDirectoryPath()}{Path.DirectorySeparatorChar}Documents{Path.DirectorySeparatorChar}{settings.BoxReportsFolderName}"; settings.BoxReportsFolderPath = path; } return settings; }
0
9. Example
View licenseprivate BoxEnvironmentConfigFileValidation ValidateConfigFileValues(string jsonString) { var validation = new BoxEnvironmentConfigFileValidation(); var config = BoxPlatformUtilities.ParseBoxConfig(jsonString); validation.HasClientId = (!string.IsNullOrEmpty(config.AppSettings.ClientId)); validation.HasClientSecret = (!string.IsNullOrEmpty(config.AppSettings.ClientSecret)); validation.HasPublicKeyId = (!string.IsNullOrEmpty(config.AppSettings.AppAuth.PublicKeyId)); validation.HasEnterpriseId = (!string.IsNullOrEmpty(config.EnterpriseId)); if (validation.HasClientId && validation.HasClientSecret && validation.HasEnterpriseId && validation.HasPublicKeyId) { validation.IsValid = true; } return validation; }
0
10. Example
View licenseprivate async Task RunCreate() { base.CheckForValue(this._membershipId.Value, this._app, "A group memebership ID is required for this command."); var role = ""; if (this._admin.HasValue()) { role = "admin"; } else if (this._member.HasValue()) { role = "member"; } var boxClient = base.ConfigureBoxClient(base._asUser.Value()); var memberRequest = new BoxGroupMembershipRequest(); if (!string.IsNullOrEmpty(role)) { memberRequest.Role = role; } else { throw new Exception("Couldn't update the user's membership role."); } var updatedMembership = await boxClient.GroupsManager.UpdateGroupMembershipAsync(this._membershipId.Value, memberRequest); if (base._json.HasValue() || this._home.GetBoxHomeSettings().GetOutputJsonSetting()) { base.OutputJson(updatedMembership); return; } Reporter.WriteSuccess("Updated the user's role."); base.PrintGroupMember(updatedMembership); }
0
11. Example
View licensepublic bool UpdateNameReference(ConfuserContext context, INameService service) { string typeName = sig.ReflectionName; string prefix = xmlnsCtx.GetPrefix(sig.ReflectionNamespace, sig.ToBasicTypeDefOrRef().ResolveTypeDefThrow().Module.Assembly); if (!string.IsNullOrEmpty(prefix)) typeName = prefix + ":" + typeName; rec.Value = typeName + "." + member.Name; return true; }
0
12. Example
View licensevoid ApplyInfo(IDnlibDef context, ProtectionSettings settings, IEnumerable<ProtectionSettingsInfo> infos, ApplyInfoType type) { foreach (var info in infos) { if (info.Condition != null && !(bool)info.Condition.Evaluate(context)) continue; if (info.Condition == null && info.Exclude) { if (type == ApplyInfoType.CurrentInfoOnly || (type == ApplyInfoType.CurrentInfoInherits && info.ApplyToMember)) { settings.Clear(); } } if (!string.IsNullOrEmpty(info.Settings)) { if ((type == ApplyInfoType.ParentInfo && info.Condition != null && info.ApplyToMember) || type == ApplyInfoType.CurrentInfoOnly || (type == ApplyInfoType.CurrentInfoInherits && info.Condition == null && info.ApplyToMember)) { parser.ParseProtectionString(settings, info.Settings); } } } }
0
13. Example
View licensepublic bool UpdateNameReference(ConfuserContext context, INameService service) { string name = sig.ReflectionName; string prefix = xmlnsCtx.GetPrefix(sig.ReflectionNamespace, sig.ToBasicTypeDefOrRef().ResolveTypeDefThrow().Module.Assembly); if (!string.IsNullOrEmpty(prefix)) name = prefix + ":" + name; if (propRec != null) propRec.Value = name; else textRec.Value = name; return true; }
0
14. Example
View licensevoid PathBox_TextChanged(object sender, TextChangedEventArgs e) { PwdBox.IsEnabled = !string.IsNullOrEmpty(PathBox.Text); }
0
15. Example
View licensepublic static string NullIfEmpty(this string val) { if (string.IsNullOrEmpty(val)) return null; return val; }
0
16. Example
View licensebool ToInfo(ObfuscationAttributeInfo attr, out ProtectionSettingsInfo info) { info = new ProtectionSettingsInfo(); info.Condition = null; info.Exclude = (attr.Exclude ?? true); info.ApplyToMember = (attr.ApplyToMembers ?? true); info.Settings = attr.FeatureValue; bool ok = true; try { new ObfAttrParser(protections).ParseProtectionString(null, info.Settings); } catch { ok = false; } if (!ok) { context.Logger.WarnFormat("Ignoring rule '{0}' in {1}.", info.Settings, attr.Owner); return false; } if (!string.IsNullOrEmpty(attr.FeatureName)) throw new ArgumentException("Feature name must not be set. Owner=" + attr.Owner); if (info.Exclude && (!string.IsNullOrEmpty(attr.FeatureName) || !string.IsNullOrEmpty(attr.FeatureValue))) { throw new ArgumentException("Feature property cannot be set when Exclude is true. Owner=" + attr.Owner); } return true; }
0
17. Example
View license[Fact] public void TestNewContactProperties() { var contact = new app.Models.Contact(); Assert.True(string.IsNullOrEmpty(contact.lastName)); Assert.True(string.IsNullOrEmpty(contact.firstName)); Assert.True(string.IsNullOrEmpty(contact.email)); Assert.True(string.IsNullOrEmpty(contact.phone)); }
0
18. Example
View license[Fact] public void Test1() { var contact = new aspnetCoreReactTemplate.Models.Contact(); Assert.True(string.IsNullOrEmpty(contact.email)); }
0
19. Example
View license[Fact] public void Test1() { var contact = new aspnetCoreReactTemplate.Models.Contact(); Assert.True(string.IsNullOrEmpty(contact.email)); }
0
20. Example
View license[Fact] public void TestNewContactProperties() { var contact = new app.Models.Contact(); Assert.True(string.IsNullOrEmpty(contact.lastName)); Assert.True(string.IsNullOrEmpty(contact.firstName)); Assert.True(string.IsNullOrEmpty(contact.email)); Assert.True(string.IsNullOrEmpty(contact.phone)); }
0
21. Example
View license[Test] public void Create_OverridesTheBillingAddressInTheNonce() { var customer = gateway.Customer.Create().Target; var nonce = TestHelper.GetNonceForNewCreditCard( gateway, new Params { { "number", "4111111111111111" }, { "expirationMonth", "12" }, { "expirationYear", "2020" }, { "options", new Params { { "validate", false } } } }); Assert.IsFalse(string.IsNullOrEmpty(nonce)); var result = gateway.PaymentMethod.Create(new PaymentMethodRequest { PaymentMethodNonce = nonce, CustomerId = customer.Id, BillingAddress = new PaymentMethodAddressRequest { StreetAddress = "123 Abc Way" } }); Assert.IsTrue(result.IsSuccess()); Assert.That(result.Target, Is.InstanceOf(typeof(CreditCard))); var token = result.Target.Token; var foundCreditCard = gateway.CreditCard.Find(token); Assert.IsNotNull(foundCreditCard); Assert.AreEqual("123 Abc Way", foundCreditCard.BillingAddress.StreetAddress); }
0
22. Example
View license[Test] public void Create_AllowsPassingBillingAddressOutsideTheNonce() { var customer = gateway.Customer.Create().Target; var nonce = TestHelper.GetNonceForNewCreditCard( gateway, new Params { { "number", "4111111111111111" }, { "expirationMonth", "12" }, { "expirationYear", "2020" }, { "options", new Params { { "validate", false } } } }); Assert.IsFalse(string.IsNullOrEmpty(nonce)); var result = gateway.PaymentMethod.Create(new PaymentMethodRequest { PaymentMethodNonce = nonce, CustomerId = customer.Id, BillingAddress = new PaymentMethodAddressRequest { StreetAddress = "123 Abc Way" } }); Assert.IsTrue(result.IsSuccess()); Assert.That(result.Target, Is.InstanceOf(typeof(CreditCard))); var token = result.Target.Token; var foundCreditCard = gateway.CreditCard.Find(token); Assert.IsNotNull(foundCreditCard); Assert.AreEqual("123 Abc Way", foundCreditCard.BillingAddress.StreetAddress); }
0
23. Example
View license[Test] public void Create_DoesNotOverrideTheBillingAddressForVaultedCreditCards() { var customer = gateway.Customer.Create().Target; var nonce = TestHelper.GetNonceForNewCreditCard( gateway, new Params { { "number", "4111111111111111" }, { "expirationMonth", "12" }, { "expirationYear", "2020" }, { "billing_address", new Params { { "street_address", "456 Xyz Way" } } } }, customer.Id); Assert.IsFalse(string.IsNullOrEmpty(nonce)); var result = gateway.PaymentMethod.Create(new PaymentMethodRequest { PaymentMethodNonce = nonce, CustomerId = customer.Id, BillingAddress = new PaymentMethodAddressRequest { StreetAddress = "123 Abc Way" } }); Assert.IsTrue(result.IsSuccess()); Assert.That(result.Target, Is.InstanceOf(typeof(CreditCard))); var token = result.Target.Token; var foundCreditCard = gateway.CreditCard.Find(token); Assert.IsNotNull(foundCreditCard); Assert.AreEqual("456 Xyz Way", foundCreditCard.BillingAddress.StreetAddress); }
0
24. Example
View license[Test] public void Create_PayPalOnlyMultiCurrencyMerchant() { gateway = /n ..... /n //View Source file for more details /n }
0
25. Example
View license[Test] public void Create_ReturnsMerchantAndCredentials() { ResultImpl<Merchant> result = gateway.Merchant.Create(new MerchantRequest { Email = "[email protected]", CountryCodeAlpha3 = "USA", PaymentMethods = new string[] {"credit_card", "paypal"}, Scope = "read_write,shared_vault_transactions", }); Assert.IsTrue(result.IsSuccess()); Assert.IsFalse(string.IsNullOrEmpty(result.Target.Id)); Assert.AreEqual("[email protected]", result.Target.Email); Assert.AreEqual("[email protected]", result.Target.CompanyName); Assert.AreEqual("USA", result.Target.CountryCodeAlpha3); Assert.AreEqual("US", result.Target.CountryCodeAlpha2); Assert.AreEqual("840", result.Target.CountryCodeNumeric); Assert.AreEqual("United States of America", result.Target.CountryName); Assert.IsTrue(result.Target.Credentials.AccessToken.StartsWith("access_token$")); Assert.IsTrue(result.Target.Credentials.RefreshToken.StartsWith("refresh_token$")); Assert.IsTrue(result.Target.Credentials.ExpiresAt > DateTime.Now); Assert.AreEqual("bearer", result.Target.Credentials.TokenType); Assert.AreEqual("read_write,shared_vault_transactions", result.Target.Credentials.Scope); }
0
26. Example
View license[Test] public void Create_DefaultsToUSDForNonUSMerchantIfOnboardingApplicationIsInternalAndC/n ..... /n //View Source file for more details /n }
0
27. Example
View license[Test] public void Create_MultiCurrencyMerchant() { gateway = new Braint/n ..... /n //View Source file for more details /n }
0
28. Example
View license[Test] public void Create_AllowsCreationOfNonUSMerchantIfOnboardingApplicationIsInternal() /n ..... /n //View Source file for more details /n }
0
29. Example
View licenseprivate string BuildRelationshipPath(string parentRelationshipPath, IRelationshipMapping relationship) { if (string.IsNullOrEmpty(parentRelationshipPath)) { return relationship.RelationshipName; } else { return $"{parentRelationshipPath}.{relationship.RelationshipName}"; } }
0
30. Example
View license[TestMethod] public async Task LocalizedValidationMessage() { var em1 = await TestFns.NewEm(_serviceName); var vr = new RequiredValidator(); var mt = vr.LocalizedMessage.Message; Assert.IsTrue(!String.IsNullOrEmpty(mt)); Assert.IsTrue(vr.LocalizedMessage.IsLocalized); }
0
31. Example
View licensepublic static String ToStructuralTypeName(String shortName, String ns) { if (String.IsNullOrEmpty(ns)) { return shortName; } else { return shortName + ":#" + ns; } }
0
32. Example
View licensepublic ActionResult ResourceModel(string modelName) { if (!String.IsNullOrEmpty(modelName)) { ModelDescriptionGenerator modelDescriptionGenerator = Configuration.GetModelDescriptionGenerator(); ModelDescription modelDescription; if (modelDescriptionGenerator.GeneratedModels.TryGetValue(modelName, out modelDescription)) { return View(modelDescription); } } return View(ErrorViewName); }
0
33. Example
View licensepublic ActionResult Api(string apiId) { if (!String.IsNullOrEmpty(apiId)) { HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId); if (apiModel != null) { return View(apiModel); } } return View(ErrorViewName); }
0
34. Example
View licenseprotected override int QueryStatusOnNode(Guid cmdGroup, uint cmd, IntPtr pCmdText, ref QueryStatusRe/n ..... /n //View Source file for more details /n }
0
35. Example
View licensepublic override bool get_IsOpen(string viewKind) { if(this.Node == null || this.Node.ProjectMgr == null || this.Node.ProjectMgr.IsClosed || this.Node.ProjectMgr.Site == null) { throw new InvalidOperationException(); } // Validate input params Guid logicalViewGuid = VSConstants.LOGVIEWID_Primary; try { if(!(String.IsNullOrEmpty(viewKind))) { logicalViewGuid = new Guid(viewKind); } } catch(FormatException) { // Not a valid guid throw new ArgumentException(SR.GetString(SR.ParameterMustBeAValidGuid, CultureInfo.CurrentUICulture), "viewKind"); } bool isOpen = false; using(AutomationScope scope = new AutomationScope(this.Node.ProjectMgr.Site)) { IVsUIHierarchy hier; uint itemid; IVsWindowFrame windowFrame; isOpen = VsShellUtilities.IsDocumentOpen(this.Node.ProjectMgr.Site, this.Node.Url, logicalViewGuid, out hier, out itemid, out windowFrame); } return isOpen; }
0
36. Example
View licenseprotected virtual void RecoverFromRenameFailure(string fileThatFailed, string originalFileName) { if(this.ItemNode != null && !String.IsNullOrEmpty(originalFileName)) { this.ItemNode.Rename(originalFileName); } }
0
37. Example
View licensepublic override string GetComponentName() { string caption = this.Node.Caption; if(string.IsNullOrEmpty(caption)) { return base.GetComponentName(); } else { return caption; } }
0
38. Example
View licenseprivate void CleanAndFlushClipboard() { IOleDataObject oleDataObject = null; ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleGetClipboard(out oleDataObject)); if(oleDataObject == null) { return; } string sourceProjectPath = DragDropHelper.GetSourceProjectPath(oleDataObject); if(!String.IsNullOrEmpty(sourceProjectPath) && NativeMethods.IsSamePath(sourceProjectPath, this.GetMkDocument())) { ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleFlushClipboard()); int clipboardOpened = 0; try { ErrorHandler.ThrowOnFailure(clipboardOpened = UnsafeNativeMethods.OpenClipboard(IntPtr.Zero)); ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.EmptyClipboard()); } finally { if(clipboardOpened == 1) { ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.CloseClipboard()); } } } }
0
39. Example
View licenseinternal NestedProjectNode GetNestedProjectForHierarchy(IVsHierarchy hierarchy) { IVsProject3 project = hierarchy as IVsProject3; if (project != null) { string mkDocument = String.Empty; ErrorHandler.ThrowOnFailure(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out mkDocument)); if (!String.IsNullOrEmpty(mkDocument)) { HierarchyNode node = this.FindChild(mkDocument); return node as NestedProjectNode; } } return null; }
0
40. Example
View license[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Scc")] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "scc")] protected internal override void GetSccSpecialFiles(string sccFile, IList<string> files, IList<tagVsSccFilesFlags> flags) { if(this.ExcludeNodeFromScc) { return; } if(files == null) { throw new ArgumentNullException("files"); } if(flags == null) { throw new ArgumentNullException("flags"); } if(string.IsNullOrEmpty(sccFile)) { throw new ArgumentException(SR.GetString(SR.InvalidParameter, CultureInfo.CurrentUICulture), "sccFile"); } // Get the file node for the file passed in. FileNode node = this.FindChild(sccFile) as FileNode; // Dependents do not participate directly in scc. if(node != null && !(node is DependentFileNode)) { node.GetSccSpecialFiles(sccFile, files, flags); } }
0
41. Example
View licenseprotected override bool CanShowDefaultIcon() { if(!String.IsNullOrEmpty(this.VirtualNodeName)) { return true; } return false; }
0
42. Example
View licenseprotected override bool CanShowDefaultIcon() { return !String.IsNullOrEmpty(this.installedFilePath); }
0
43. Example
View licenseinternal string GetMigrationsTable() { return string.IsNullOrEmpty(MigrationsTable) ? "Migrations" : MigrationsTable; }
0
44. Example
View licenseinternal string GetConnectionString(DatabaseProvider provider) { if (provider != DatabaseProvider.SqlServer) throw new Exception($"Unsupported DatabaseProvider " + provider); if (!string.IsNullOrEmpty(ConnectionString)) return ConnectionString; var server = string.IsNullOrEmpty(Server) ? "localhost" : Server; return $"Persist Security Info=False;Integrated Security=true;Initial Catalog={Database};server={server}"; }
0
45. Example
View licensepublic void SendToChannel(string channelName, string message) { if (string.IsNul/n ..... /n //View Source file for more details /n }
0
46. Example
View licensepublic static void UpdateHotKey(string id, Keys keyData) { if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(nameof(id)); HotKeyData data = Cache.FirstOrDefault(hkd => hkd.Id == id); if (data == null) return; Cache.Remove(data.KeyData); data.KeyData = keyData; Cache.Add(data); }
0
47. Example
View licenseprivate void ApplyConfiguration() { Settings settings = Configuration.Current; userFormSize = settings.UserSize; VisibleClientSize = userFormSize; colorIndex = settings.ColorIndex; isThumbnailed = settings.IsThumbnailed; maxThumbSize = settings.MaxThumbnailSize; Location = settings.Location; TopMost = settings.AlwaysOnTop; if (settings.HotKeySettings != null) foreach (HotKeySetting hk in settings.HotKeySettings) { if (string.IsNullOrEmpty(hk.Id)) continue; HotKeys.UpdateHotKey(hk.Id, (Keys) hk.KeyCode); } if (settings.UserOpacity < 0.1 || settings.UserOpacity > 0.9) settings.UserOpacity = 0.4; LayerOpacity = !settings.UsePerPixelAlpha ? settings.UserOpacity : 1.0; if (ImageCapture.ImageOutputs[settings.ImageFormat] != null) { imageCapture.ImageFormat = ImageCapture.ImageOutputs[settings.ImageFormat]; outputDescription = imageCapture.ImageFormat.Description; } else { outputDescription = SR.MessageNoOutputLoaded; } }
0
48. Example
View licenseprivate static string GetThumbImageTemplate() { return !string.IsNullOrEmpty(Configuration.Current.ThumbImageTemplate) ? Configuration.Current.ThumbImageTemplate : DefaultThumbImageTemplate; }
0
49. Example
View licenseprivate static string GetFullImageTemplate() { return !string.IsNullOrEmpty(Configuration.Current.FullImageTemplate) ? Configuration.Current.FullImageTemplate : DefaultFullImageTemplate; }
0
50. Example
View licensepublic override string ToString() { if (!string.IsNullOrEmpty(this.Value)) { return this.ParamString + " " + this.Value; } return string.Empty; }