Tutorial by Examples: attribut

Attributes are global state (*). If they were implemented in JavaScript they would look something like this // pseudo code gl = { ARRAY_BUFFER: null, vertexArray: { attributes: [ { enable: ?, type: ?, size: ?, normalize: ?, stride: ?, offset: ?, buffer: ? }, { enabl...
//all attributes $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('*'); //specific attributes $collection = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToSelect('name'); //certain attributes are special...
System.Obsolete is an attribute that is used to mark a type or a member that has a better version, and thus should not be used. [Obsolete("This class is obsolete. Use SomeOtherClass instead.")] class SomeClass { // } In case the class above is used, the compiler will give the w...
DisplayName sets display name for a property, event or public void method having zero (0) arguments. public class Employee { [DisplayName(@"Employee first name")] public string FirstName { get; set; } } Simple usage example in XAML application <Window x:Class="WpfA...
EditableAttribute sets whether users should be able to change the value of the class property. public class Employee { [Editable(false)] public string FirstName { get; set; } } Simple usage example in XAML application <Window x:Class="WpfApplication.MainWindow" ...
# example data DT = data.table(iris) To modify factor levels by reference, use setattr: setattr(DT$Species, "levels", c("set", "ver", "vir") # or DT[, setattr(Species, "levels", c("set", "ver", "vir"))] The sec...
Attributes can be accessed strings and symbols as keys. Numerical indexes also work. Person = Struct.new :name alice = Person.new 'Alice' alice['name'] # => "Alice" alice[:name] # => "Alice" alice[0] # => "Alice"
You can use either DOM Level 2 Core methods getAttribute(), getAttributeNS(), setAttribute(), and setAttributeNS() to read and write values from SVG elements, or you can use custom properties and methods specified in the SVG 1.1 IDL (Interface Definition Language). Simple Numeric Attributes For ex...
NSMutableDictionary *attributesDictionary = [NSMutableDictionary dictionary]; [attributesDictionary setObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName]; //[attributesDictionary setObject:[UIColor redColor] forKey:NSForegroundColorAttributeName]; NSMutableAttributedString *attri...
Validation attributes are used to enforce various validation rules in a declarative fashion on classes or class members. All validation attributes derive from the ValidationAttribute base class. Example: RequiredAttribute When validated through the ValidationAttribute.Validate method, this att...
using System.ComponentModel.DataAnnotations.Schema; public class Department { ... public virtual ICollection<Employee> PrimaryEmployees { get; set; } public virtual ICollection<Employee> SecondaryEmployees { get; set; } } public class Employee { ...
using System.ComponentModel.DataAnnotations.Schema; [ComplexType] public class BlogDetails { public DateTime? DateCreated { get; set; } [MaxLength(250)] public string Description { get; set; } } public class Blog { ... public BlogDetails BlogDetail { get...
Custom validation attributes can be created by deriving from the ValidationAttribute base class, then overriding virtual methods as needed. [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)] public class NotABananaAttribute : ValidationAttribute { public ov...
The following snippet replaces all Attributes called PreviousAttribute by an Attribute called ReplacementAttribute for an entire solution. The sample manually searches the Syntax tree and replaces all affected nodes. static async Task<bool> ModifySolution(string solutionPath) { ...
The following snippet replaces all Attributes called "PreviousAttribute" by an Attribute called "ReplacementAttribute" for an entire solution. The sample manually uses a SyntaxRewriter to exchange the attributes. /// <summary> /// The CSharpSyntaxRewriter allows to rewrit...
Some attributes are directly accessible as properties of the element (e.g. alt, href, id, title and value). document.querySelector("a").href = "#top"; Other attributes, including data-attributes can be set as follows: document.querySelector("a").setAttribute("...
To remove an attribute, including directly accessible properties document.querySelector("a").removeAttribute("title"); Data attributes can also be removed as follows (modern browsers): // remove "data-foo" attribute delete document.querySelector("a").dat...
The following query returns the documents which have an element named "company" - cts:element-value-query( xs:QName('company'), '*', ("wildcarded"))) The following query returns the documents which have an element named "company" with an attribute named "name&...
These attributes are used when the layout is rendered in Android Studio, but have no impact on the runtime. In general you can use any Android framework attribute, just using the tools: namespace rather than the android: namespace for layout preview. You can add both the android: namespace attribu...
The Compare attribute compares two properties of a model. The error message can be specified using property ErrorMessage, or using resource files. To use Compare attribute include using for the following namespace: using System.ComponentModel.DataAnnotations; Then you can use the attribute in ...

Page 6 of 10