Catel.Runtime.Serialization.SerializationManager.GetFieldNames C# (CSharp) Method

GetFieldNames() public method

Gets the field names.
The is null.
public GetFieldNames ( Type type ) : HashSet
type System.Type Type of the model.
return HashSet
        public HashSet<string> GetFieldNames(Type type)
        {
            Argument.IsNotNull("type", type);

            return _fieldNamesCache.GetFromCacheOrFetch(type, () =>
            {
                var fieldNames = GetFields(type);

                var finalFields = new HashSet<string>();
                foreach (var fieldName in fieldNames)
                {
                    finalFields.Add(fieldName.Key);
                }

                return finalFields;
            });
        }

Usage Example

            public void ReturnsCorrectValue()
            {
                var serializationManager = new SerializationManager();

                var fields = serializationManager.GetFieldNames(typeof(TestModel)).ToArray();

                Assert.AreEqual(1, fields.Length);
                Assert.AreEqual("_includedField", fields[0]);
            }
All Usage Examples Of Catel.Runtime.Serialization.SerializationManager::GetFieldNames