You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we add a new field to our table, we need to update all build method in project. I prefer a method with default value for new field.
for example, our table
Table{
count:int;
name:string;
age:int;
}
the fbs code generator can be able to generate all build methods for 1, 2 and 3 parameters.
Build(int count){
return build(count,0,0);
}
Build(int count, string name){
return build(count,name,0);
}
Build(int count, string name,int age){
return build(count,name,age);
}
So new added fields do not require project code changes. They can use default value.
If it already exist or alternative, sorry i could not found.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When we add a new field to our table, we need to update all build method in project. I prefer a method with default value for new field.
for example, our table
Table{
count:int;
name:string;
age:int;
}
the fbs code generator can be able to generate all build methods for 1, 2 and 3 parameters.
Build(int count){
return build(count,0,0);
}
Build(int count, string name){
return build(count,name,0);
}
Build(int count, string name,int age){
return build(count,name,age);
}
So new added fields do not require project code changes. They can use default value.
If it already exist or alternative, sorry i could not found.
What do you think about build overloading?
Beta Was this translation helpful? Give feedback.
All reactions